Last active
April 16, 2016 17:53
-
-
Save jakeydevs/860446423c0a1ecf245765252cb91b5d to your computer and use it in GitHub Desktop.
Run every X seconds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
//-- Run at least every 5 seconds | |
$diff = 5; | |
//-- Get my time | |
$time_check = 0; | |
//-- Always run | |
while (1) { | |
//-- Get time now | |
$time = microtime(); | |
if ((microtime() - $time_check) > $diff) { | |
//-- WORKING CODE | |
//-- Reset the time check | |
$time_check = microtime(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment