Home  >  Article  >  Backend Development  >  PHP uses the gettimeofday function to return the current time and store it in an associative array_PHP tutorial

PHP uses the gettimeofday function to return the current time and store it in an associative array_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:02:341049browse

PHP uses the gettimeofday function to return the current time and stores it in an associative array

This article mainly introduces how PHP uses the gettimeofday function to return the current time and stores it in an associative array. Regarding the usage skills of gettimeofday function in php, friends who need it can refer to it

The example in this article describes how PHP uses the gettimeofday function to return the current time and store it in an associative array. Share it with everyone for your reference. The specific analysis is as follows:

The official English description is as follows:

Key Description
sec Seconds since midnight before January 1, 1970
usec Microseconds since the sec value
minuteswest
Local time zone difference from GMT, in minutes
dsttime 1 iff daylight savings time is in effect,
0 iff not.

?

1

2

3

4

5

6

7

$Now = gettimeofday();

echo "As an associative array:n";

foreach ($Now as $Key => $Value) {

echo "$Key => $Valuen";

}

?>

1 2

3

4

5

6

1

2

3

4

sec => 1261918156

usec => 724964

minuteswest => 0

dsttime => 0

7

$Now = gettimeofday();

echo "As an associative array:n";

foreach ($Now as $Key => $Value) {echo "$Key => $Valuen"; } ?>

The output results are as follows:
?
1 2 3 4 sec => 1261918156 usec => 724964 minuteswest => 0 dsttime => 0
I hope this article will be helpful to everyone’s PHP programming design. http://www.bkjia.com/PHPjc/970746.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970746.htmlTechArticlephp uses the gettimeofday function to return the current time and stores it in an associative array. This article mainly introduces how php uses the gettimeofday function to return Method to store the current time in an associative array...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn