Print local time as both an indexed and an associative array.
| <?php print_r(localtime()); echo “<br><br>”; print_r(localtime(time(),true)); ?> |
The localtime() function returns the local time.
| localtime(timestamp, is_assoc) |
|
Parameter |
Description |
|
timestamp |
Optional. Specifies a Unix timestamp, defaulting to the current local time ( |
|
is_assoc |
Optional. Specifies whether to return an associative or indexed array. FALSE returns an indexed array (default), while TRUE returns an associative array. The keys of the associative array are:
|
|
Return Value: |
Returns an array containing the components of a Unix timestamp. |
|
PHP Version: |
4+ |
|
PHP Changelog: |
PHP 5.1: Now triggers E_STRICT and E_NOTICE time zone errors. |