Previously, we used the strtotime () function to compare the size of two dates. apart from comparing the size of two dates, PHP can also accurately calculate the difference between two dates. In this chapter, we still use the strtotime () function to develop a countdown function. Previously, we used the strtotime () function to compare the size of two dates. apart from comparing the size of two dates, PHP can also accurately calculate the difference between two dates. In this chapter, we still use the strtotime () function to develop a countdown function.
The strtotime () function parses the date and time of any English text into a UNIX timestamp. we have explained it before. we will not introduce it too much here. let's look at the code directly.
Countdown applet instanceThe code is as follows:
"; Echo" is still ".." ".. $ sub2." "." day !!! ";?>
Code running result:
";echo ceil(5.1);?>
Result of running the ceil () function instance:
In the next section, we will explain how to calculate the running time of page scripts ".
The above is a detailed description of the countdown function using the PHP time and date function strtotime (). For more information, see other related articles in the first PHP community!