note 97524 deleted from function.strtotime by googleguy
| From: | googleguy@php.net | Date: | Fri, 05 Apr 2013 14:54:23 +0000 |
| Subject: | note 97524 deleted from function.strtotime by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194353@lists.php.net to get a copy of this message | ||
Note Submitter: kovzol at particio dot com
----
strtotime(NULL) will give different outputs in PHP 4.4.4 (Debian Linux 4.0) and PHP 5.2.6 (Debian
Linux 5.0). The first case gives the number of seconds for today from epoch (1970-01-01), but the
second one gives no output.
As a consequence, the following code gives the current year in PHP 4.4.4, but it gives 1970 in PHP
5.2.6:
<?php
echo date("Y", strtotime(NULL));
?>
As a workaround,
<?php
echo date("Y", strtotime("now"));
?>
will work for both versions well.