Use the PHP time and date function strtotime () to implement the countdown function.

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.