Compdigitec Labs

« | Home | »

Simple timer script for command-line PHP

By admin | November 12, 2008

Are you looking for a simple timer script written in command-line PHP? If so, here is one pre-written (released under the GPL v2 or later):

<?php
define("endl","\n");
// Timer script
if($argv[1] == "") {
 	echo "Usage: ".$argv[0]." minutes".endl;
 	die();
}
$dtime = strtotime("+".$argv[1]." minute");

while(true) {
 	echo "Enter to check time: ";
 	$tt = fgets(STDIN);
 	$i = date("i",$dtime-time());
 	$s = date("s",$dtime-time());
 	echo "$i minutes, $s seconds".endl;
}
?>

Usage: When launching use first parameter as number of minutes to count (0-59 min). Press enter to check the time.

If you found this script useful or helpful, please help Compdigitec by spreading the word. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: PHP | 16 Comments »

16 Responses to “Simple timer script for command-line PHP”

  1. amb99 Says:
    May 1st, 2022 at 18:12

    … [Trackback]

    […] There you can find 70486 more Information to that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  2. Buy Juul Pods online Says:
    July 6th, 2022 at 09:31

    … [Trackback]

    […] Read More here on that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  3. crédit de particulier à particulier belgique Says:
    August 20th, 2022 at 16:17

    … [Trackback]

    […] Read More Information here to that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  4. Darknet Support Says:
    August 31st, 2022 at 11:01

    … [Trackback]

    […] There you can find 22087 more Info on that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  5. stoeger condor Says:
    September 8th, 2022 at 10:20

    … [Trackback]

    […] There you can find 51119 additional Information on that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  6. passive income ideas Says:
    October 12th, 2022 at 05:20

    … [Trackback]

    […] Info to that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  7. maxbet Says:
    December 3rd, 2022 at 19:10

    … [Trackback]

    […] Find More here to that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  8. เอสบีโอเบท Says:
    December 11th, 2022 at 15:52

    … [Trackback]

    […] Information to that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  9. Site internet pour plus d'informations Says:
    January 10th, 2023 at 06:01

    … [Trackback]

    […] Find More Info here to that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  10. passive income investments Says:
    January 19th, 2023 at 07:41

    … [Trackback]

    […] Read More Information here to that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  11. addiction therapy Says:
    February 7th, 2023 at 19:25

    … [Trackback]

    […] Read More on that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  12. PGSLOT โบนัสแตก Says:
    March 3rd, 2023 at 18:21

    … [Trackback]

    […] Find More on to that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  13. Pink Lemonade 1.2g Wax Infused Pre-Roll Says:
    March 7th, 2023 at 19:02

    … [Trackback]

    […] Info on that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  14. Belle & Sac Says:
    March 10th, 2023 at 03:54

    … [Trackback]

    […] Read More here to that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  15. Buy Magic Mushroom in Brisbane Says:
    March 11th, 2023 at 13:58

    … [Trackback]

    […] Find More here on that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

  16. สล็อตเว็บตรงไม่มีขั้นต่ำ Says:
    March 13th, 2023 at 20:49

    … [Trackback]

    […] Find More on on that Topic: compdigitec.com/labs/2008/11/12/simple-timer-script-for-command-line-php/ […]

Comments