Skip to content

Instantly share code, notes, and snippets.

@devi
Created June 12, 2011 08:06
Show Gist options
  • Select an option

  • Save devi/1021338 to your computer and use it in GitHub Desktop.

Select an option

Save devi/1021338 to your computer and use it in GitHub Desktop.
Kohana Valid::timestamp()
<?php defined('SYSPATH') or die('No direct script access.');
class Valid extends Kohana_Valid {
/**
* TODO: test
* http://stackoverflow.com/questions/3377537/checking-if-a-string-holds-an-integer/3377612
*
*/
public static function timestamp($timestamp)
{
if ( ! (string)(int)$timestamp === $timestamp)
{
return Valid::date($timestamp);
}
return ($timestamp >= 0) AND ($timestamp <= PHP_INT_MAX);
}
} // End Valid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment