Are there any differences between using functions time() and mktime() with default parameters to obtain current timestamp?
The mktime() function returns the Unix timestamp for a date. This timestamp is a long integer containing the number of seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time specified.
The time() function returns the current time in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
The mktime() function is an inbuilt function in PHP which is used to return the Unix timestamp for a date. The timestamp returns a long integer containing the number of seconds between the Unix Epoch (January 1, 1970, 00:00:00 GMT) and the time specified.
"As of PHP 5.1, when called with no arguments, mktime() throws an E_STRICT notice: use the time() function instead."
http://php.net/manual/en/function.mktime.php
If you want to use dates/times, I recommend DateTime instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With