{"id":52,"date":"2008-11-12T20:39:29","date_gmt":"2008-11-13T00:39:29","guid":{"rendered":"http:\/\/www.compdigitec.com\/labs\/?p=52"},"modified":"2009-09-17T20:11:55","modified_gmt":"2009-09-18T00:11:55","slug":"simple-timer-script-for-command-line-php","status":"publish","type":"post","link":"http:\/\/www.compdigitec.com\/labs\/2008\/11\/12\/simple-timer-script-for-command-line-php\/","title":{"rendered":"Simple timer script for command-line PHP"},"content":{"rendered":"<p>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):<\/p>\n<pre><pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\ndefine(&quot;endl&quot;,&quot;\\n&quot;);\r\n\/\/ Timer script\r\nif($argv[1] == &quot;&quot;) {\r\n \techo &quot;Usage: &quot;.$argv[0].&quot; minutes&quot;.endl;\r\n \tdie();\r\n}\r\n$dtime = strtotime(&quot;+&quot;.$argv[1].&quot; minute&quot;);\r\n\r\nwhile(true) {\r\n \techo &quot;Enter to check time: &quot;;\r\n \t$tt = fgets(STDIN);\r\n \t$i = date(&quot;i&quot;,$dtime-time());\r\n \t$s = date(&quot;s&quot;,$dtime-time());\r\n \techo &quot;$i minutes, $s seconds&quot;.endl;\r\n}\r\n?&gt;\r\n<\/pre>\n<p><strong>Usage:<\/strong> When launching use first parameter as number of minutes to count (0-59 min). Press enter to check the time.<\/p>\n<p>If you found this script useful or helpful, please help Compdigitec by spreading the word. Don&#8217;t forget to <a href=\"http:\/\/www.compdigitec.com\/labs\/feed\">subscribe to Compdigitec Labs<\/a> for more interesting articles!<\/p>","protected":false},"excerpt":{"rendered":"<p>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): 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[249,213,253,252,245,246,251,250,254,247,864,243,244,248,242],"_links":{"self":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/52"}],"collection":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/comments?post=52"}],"version-history":[{"count":0,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/52\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/media?parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/categories?post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/tags?post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}