note 34171 added to function.strtotime
| From: | Tim at rack1 dot php dot net | Date: | Thu, 17 Jul 2003 14:30:03 +0000 |
| Subject: | note 34171 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52279@lists.php.net to get a copy of this message | ||
If anyone's wondering why this function returns -1 on failure instead of false, it's
because 0 is technically a valid UNIX timestamp. Consider this:
<?php
echo strtotime ("1 January 1970").'<br />';
echo strtotime ("1 January 19sdfsdf70");
?>
This will output:
0
-1
If strtotime() returned false on error, the above would output:
0
0
i.e. both values would be the same, even though one string is a valid date and the other isn't.
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34171
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34171&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34171&report=yes