Php implements the function code to publish information a few minutes ago

Source: Internet
Author: User
Php implements the function code to publish information a few minutes ago

  1. /**
  2. * How many minutes ago?
  3. * Site bbs.it-home.org
  4. */
  5. Function cTime ($ seconds ){
  6. If ($ seconds <60 ){
  7. $ Msg = $ seconds. "seconds ";
  8. } Elseif ($ seconds <3600 ){
  9. $ Msg = (int) ($ seconds/60). "minute ";
  10. } Elseif ($ seconds <86400 ){
  11. $ Msg = (int) ($ seconds/60/60). "hour ";
  12. } Else {
  13. $ Msg = (int) ($ seconds/60/60/24). "day ";
  14. }
  15. Return $ msg;
  16. }
  17. ?>

2. call method:

  1. $ Addtime = time ();
  2. $ Seconds = $ addtime-$ rswy ['addtime'];
  3. Echo cTime ($ seconds );
  4. ?>

The above is a simple example provided by the php Tutorial today.

>>> Articles you may be interested in: implementing timeline functions in PHP (just five minutes ago) php get time, how many minutes ago example code PHP delete all files created N minutes ago small example php shows according to time, just a few minutes ago, a few hours ago implementation code

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.