note 34171 deleted from function.strtotime by nicos
| From: | nicos@php.net | Date: | Fri, 25 Jul 2003 09:30:52 +0000 |
| Subject: | note 34171 deleted from function.strtotime by nicos | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52625@lists.php.net to get a copy of this message | ||
Note Submitter: Tim Fountain
----
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.