Doc #47084 [Com]: Calling mktime() w/o arguments raises strict error
| From: | karlorbell at hotmail dot com | Date: | Thu, 08 Aug 2013 17:06:10 +0000 |
| Subject: | Doc #47084 [Com]: Calling mktime() w/o arguments raises strict error | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10157@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=47084&edit=1
ID: 47084
Comment by: karlorbell at hotmail dot com
Reported by: tacker@php.net
Summary: Calling mktime() w/o arguments raises strict error
Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
As the previous commenter has said, this is an invalid E_STRICT message.
People use mktime() without arguments as a locale-aware version of time() - it's
not an uncommon usage. As the two functions do not give the same output, it is
ludicrous to issue a warning to use the other.
Previous Comments:
------------------------------------------------------------------------
[2011-11-16 10:49:40] niklas dot karlssonn at gmail dot com
The error message its not correct either, use the time() instead of mktime? The functions does not
return the same result, time() doesn't respect the timezone setting.
------------------------------------------------------------------------
[2011-05-26 02:39:25] pansit at yahoo dot com dot ph
I would like to ask (as this has been brought up from pear but no answer was made), why is time()
recommended to use than gmmktime()?
I'm using PHP 5.3.6 with strict on and I got this message:
Strict Standards: gmmktime() [function.gmmktime.html]: You should be using the time() function
instead
------------------------------------------------------------------------
[2009-08-01 12:05:53] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
I have added a note and changelog to the mktime page to inform of the E_STRICT when called with no
arguments, making reference to use time() instead.
apradhan at sampatti dot com: that is intended behaviour. There are only 30 days in June, so by
using 31 as the $day argument it rolls over to the first of July.
------------------------------------------------------------------------
[2009-08-01 12:01:15] svn@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=286620
Log: Fixes #47084 Document mktime() E_STRICT with no arguments
------------------------------------------------------------------------
[2009-08-01 06:14:38] apradhan at sampatti dot com
I have seen a issue in mktime() for the date of 31 july
like if we write
echo date("m",mktime(0,0,0,07-1,31, 2009));
Above code will give output : 07
while logically it should be 6.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=47084
--
Edit this bug report at https://bugs.php.net/bug.php?id=47084&edit=1