3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function loadZoneDefintion() { // initial stuff $i = 1; $limit = 9; $array = array("A","B","C","D","E","F","G","H","I","J","K","L"); // foreach xml file/zone definition foreach ($array as $value) { // if counter is less than limit if ($i < $limit) { // foreach loops // process curl request echo "Counter: " . $i . ", Value: " . $value . " | "; // increment counter $i++; } // if counter has reached the limit else { echo "[PAUSE]"; $now = time(); $nowText = date("g:h:s", $now); $future = strtotime("+5 hours", $now); $futureText = date("g:h:s", $future); echo "Now: " . $nowText; echo "Future: " . $futureText; // pause script due to rate limit //sleep(10); //time_sleep_until(); // reset counter $i = 1; echo "[RESET]"; } } } loadZoneDefintion();
Output for 4.3.0 - 4.4.9, 5.0.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Counter: 1, Value: A | Counter: 2, Value: B | Counter: 3, Value: C | Counter: 4, Value: D | Counter: 5, Value: E | Counter: 6, Value: F | Counter: 7, Value: G | Counter: 8, Value: H | [PAUSE]Now: 11:11:18Future: 4:04:18[RESET]Counter: 1, Value: J | Counter: 2, Value: K | Counter: 3, Value: L |
Output for 5.0.0 - 5.0.2
Counter: 1, Value: A | Counter: 2, Value: B | Counter: 3, Value: C | Counter: 4, Value: D | Counter: 5, Value: E | Counter: 6, Value: F | Counter: 7, Value: G | Counter: 8, Value: H | [PAUSE]Now: 11:11:18Future: 5:05:00[RESET]Counter: 1, Value: J | Counter: 2, Value: K | Counter: 3, Value: L |