3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php define('ITERATIONS', 10000000); $start = microtime(true); $var = 0; while ($var < ITERATIONS) { ++$var; } $stop = microtime(true); printf("Loop type %8s took %f seconds\n", 'while', $stop - $start); $start = microtime(true); $var = 0; do { ++$var; } while ($var < ITERATIONS); $stop = microtime(true); printf("Loop type %8s took %f seconds\n", 'do-while', $stop - $start); $start = microtime(true); for ($var = 0; $var < ITERATIONS; ++$var) { //do nothing } $stop = microtime(true); printf("Loop type %8s took %f seconds\n", 'for', $stop - $start);
Output for 5.4.45
Loop type while took 0.181654 seconds Loop type do-while took 0.165891 seconds Loop type for took 0.226005 seconds
Output for 5.4.44
Loop type while took 0.198972 seconds Loop type do-while took 0.166013 seconds Loop type for took 0.255093 seconds
Output for 5.4.43
Loop type while took 0.224710 seconds Loop type do-while took 0.210120 seconds Loop type for took 0.253920 seconds
Output for 5.4.42
Loop type while took 0.221972 seconds Loop type do-while took 0.195290 seconds Loop type for took 0.248374 seconds
Output for 5.4.41
Loop type while took 0.183862 seconds Loop type do-while took 0.165881 seconds Loop type for took 0.237260 seconds
Output for 5.4.40
Loop type while took 0.181592 seconds Loop type do-while took 0.162334 seconds Loop type for took 0.221318 seconds
Output for 5.4.39
Loop type while took 0.176250 seconds Loop type do-while took 0.161090 seconds Loop type for took 0.222224 seconds
Output for 5.4.38
Loop type while took 0.193718 seconds Loop type do-while took 0.195343 seconds Loop type for took 0.222016 seconds
Output for 5.4.37
Loop type while took 0.182351 seconds Loop type do-while took 0.165274 seconds Loop type for took 0.220956 seconds
Output for 5.4.36
Loop type while took 0.181417 seconds Loop type do-while took 0.163588 seconds Loop type for took 0.218361 seconds
Output for 5.4.35
Loop type while took 0.185448 seconds Loop type do-while took 0.166983 seconds Loop type for took 0.223087 seconds
Output for 5.4.34
Loop type while took 0.177918 seconds Loop type do-while took 0.167917 seconds Loop type for took 0.224270 seconds
Output for 5.4.32
Loop type while took 0.181472 seconds Loop type do-while took 0.165940 seconds Loop type for took 0.222805 seconds
Output for 5.4.31
Loop type while took 0.175563 seconds Loop type do-while took 0.160289 seconds Loop type for took 0.217480 seconds
Output for 5.4.30
Loop type while took 0.190791 seconds Loop type do-while took 0.172299 seconds Loop type for took 0.219426 seconds
Output for 5.4.29
Loop type while took 0.196559 seconds Loop type do-while took 0.166717 seconds Loop type for took 0.229633 seconds
Output for 5.4.28
Loop type while took 0.183062 seconds Loop type do-while took 0.165947 seconds Loop type for took 0.227600 seconds
Output for 5.4.27
Loop type while took 0.189254 seconds Loop type do-while took 0.164077 seconds Loop type for took 0.226681 seconds
Output for 5.4.26
Loop type while took 0.181607 seconds Loop type do-while took 0.165906 seconds Loop type for took 0.223930 seconds
Output for 5.4.25
Loop type while took 0.181497 seconds Loop type do-while took 0.165874 seconds Loop type for took 0.227522 seconds
Output for 5.4.24
Loop type while took 0.200590 seconds Loop type do-while took 0.188050 seconds Loop type for took 0.245143 seconds
Output for 5.4.23
Loop type while took 0.186132 seconds Loop type do-while took 0.165959 seconds Loop type for took 0.225018 seconds
Output for 5.4.22
Loop type while took 0.181463 seconds Loop type do-while took 0.165828 seconds Loop type for took 0.223697 seconds
Output for 5.4.21
Loop type while took 0.201460 seconds Loop type do-while took 0.180994 seconds Loop type for took 0.247182 seconds
Output for 5.4.20
Loop type while took 0.176490 seconds Loop type do-while took 0.161118 seconds Loop type for took 0.221756 seconds
Output for 5.4.19
Loop type while took 0.181924 seconds Loop type do-while took 0.166086 seconds Loop type for took 0.226216 seconds
Output for 5.4.18
Loop type while took 0.198473 seconds Loop type do-while took 0.180629 seconds Loop type for took 0.229092 seconds
Output for 5.4.17
Loop type while took 0.181295 seconds Loop type do-while took 0.178954 seconds Loop type for took 0.224108 seconds
Output for 5.4.16
Loop type while took 0.176240 seconds Loop type do-while took 0.158275 seconds Loop type for took 0.217479 seconds
Output for 5.4.15
Loop type while took 0.181815 seconds Loop type do-while took 0.166281 seconds Loop type for took 0.224554 seconds
Output for 5.4.14
Loop type while took 0.182505 seconds Loop type do-while took 0.178920 seconds Loop type for took 0.220496 seconds
Output for 5.4.13
Loop type while took 0.186450 seconds Loop type do-while took 0.170315 seconds Loop type for took 0.225106 seconds
Output for 5.4.12
Loop type while took 0.184219 seconds Loop type do-while took 0.165773 seconds Loop type for took 0.226514 seconds
Output for 5.4.11
Loop type while took 0.184303 seconds Loop type do-while took 0.166913 seconds Loop type for took 0.224612 seconds
Output for 5.4.10
Loop type while took 0.181738 seconds Loop type do-while took 0.166062 seconds Loop type for took 0.225354 seconds
Output for 5.4.9
Loop type while took 0.197911 seconds Loop type do-while took 0.188741 seconds Loop type for took 0.251211 seconds
Output for 5.4.8
Loop type while took 0.202231 seconds Loop type do-while took 0.166107 seconds Loop type for took 0.228826 seconds
Output for 5.4.7
Loop type while took 0.176619 seconds Loop type do-while took 0.160032 seconds Loop type for took 0.221342 seconds
Output for 5.4.6
Loop type while took 0.176901 seconds Loop type do-while took 0.159588 seconds Loop type for took 0.220202 seconds
Output for 5.4.5
Loop type while took 0.189901 seconds Loop type do-while took 0.181338 seconds Loop type for took 0.245244 seconds
Output for 5.4.4
Loop type while took 0.177135 seconds Loop type do-while took 0.160672 seconds Loop type for took 0.228161 seconds
Output for 5.4.3
Loop type while took 0.222143 seconds Loop type do-while took 0.237027 seconds Loop type for took 0.231658 seconds
Output for 5.4.2
Loop type while took 0.181357 seconds Loop type do-while took 0.165971 seconds Loop type for took 0.226205 seconds
Output for 5.4.1
Loop type while took 0.181385 seconds Loop type do-while took 0.165926 seconds Loop type for took 0.227759 seconds
Output for 5.4.0
Loop type while took 0.178569 seconds Loop type do-while took 0.160950 seconds Loop type for took 0.218613 seconds
Output for 5.3.29
Loop type while took 0.502713 seconds Loop type do-while took 0.468780 seconds Loop type for took 0.521645 seconds
Output for 5.3.28
Loop type while took 0.547518 seconds Loop type do-while took 0.493054 seconds Loop type for took 0.591154 seconds
Output for 5.3.27
Loop type while took 0.498886 seconds Loop type do-while took 0.460753 seconds Loop type for took 0.528044 seconds
Output for 5.3.26
Loop type while took 0.516503 seconds Loop type do-while took 0.477913 seconds Loop type for took 0.523261 seconds
Output for 5.3.25
Loop type while took 0.513241 seconds Loop type do-while took 0.461571 seconds Loop type for took 0.543461 seconds
Output for 5.3.24
Loop type while took 0.524105 seconds Loop type do-while took 0.462088 seconds Loop type for took 0.543459 seconds
Output for 5.3.23
Loop type while took 0.512355 seconds Loop type do-while took 0.481052 seconds Loop type for took 0.558424 seconds
Output for 5.3.22
Loop type while took 0.532078 seconds Loop type do-while took 0.469242 seconds Loop type for took 0.513950 seconds
Output for 5.3.21
Loop type while took 0.506762 seconds Loop type do-while took 0.494227 seconds Loop type for took 0.533300 seconds
Output for 5.3.20
Loop type while took 0.544221 seconds Loop type do-while took 0.494797 seconds Loop type for took 0.523975 seconds
Output for 5.3.19
Loop type while took 0.516662 seconds Loop type do-while took 0.491815 seconds Loop type for took 0.517580 seconds
Output for 5.3.18
Loop type while took 0.543121 seconds Loop type do-while took 0.465375 seconds Loop type for took 0.514260 seconds
Output for 5.3.17
Loop type while took 0.522449 seconds Loop type do-while took 0.473508 seconds Loop type for took 0.516286 seconds
Output for 5.3.16
Loop type while took 0.494413 seconds Loop type do-while took 0.476243 seconds Loop type for took 0.537753 seconds
Output for 5.3.15
Loop type while took 0.492524 seconds Loop type do-while took 0.463767 seconds Loop type for took 0.517069 seconds
Output for 5.3.14
Loop type while took 0.532734 seconds Loop type do-while took 0.479332 seconds Loop type for took 0.517437 seconds
Output for 5.3.13
Loop type while took 0.502126 seconds Loop type do-while took 0.465477 seconds Loop type for took 0.513099 seconds
Output for 5.3.12
Loop type while took 0.496689 seconds Loop type do-while took 0.467073 seconds Loop type for took 0.516661 seconds
Output for 5.3.11
Loop type while took 0.588825 seconds Loop type do-while took 0.581826 seconds Loop type for took 0.586108 seconds
Output for 5.3.10
Loop type while took 0.561212 seconds Loop type do-while took 0.510608 seconds Loop type for took 0.561452 seconds
Output for 5.3.9
Loop type while took 0.518157 seconds Loop type do-while took 0.478417 seconds Loop type for took 0.519021 seconds
Output for 5.3.8
Loop type while took 0.567478 seconds Loop type do-while took 0.549017 seconds Loop type for took 0.632247 seconds
Output for 5.3.7
Loop type while took 0.507784 seconds Loop type do-while took 0.479159 seconds Loop type for took 0.528225 seconds
Output for 5.3.6
Loop type while took 0.507337 seconds Loop type do-while took 0.478286 seconds Loop type for took 0.521227 seconds
Output for 5.3.5
Loop type while took 0.518547 seconds Loop type do-while took 0.473607 seconds Loop type for took 0.537482 seconds
Output for 5.3.4
Loop type while took 0.582232 seconds Loop type do-while took 0.514208 seconds Loop type for took 0.537104 seconds
Output for 5.3.3
Loop type while took 0.535775 seconds Loop type do-while took 0.485083 seconds Loop type for took 0.546374 seconds
Output for 5.3.2
Loop type while took 0.528778 seconds Loop type do-while took 0.492536 seconds Loop type for took 0.553699 seconds
Output for 5.3.1
Loop type while took 0.591415 seconds Loop type do-while took 0.501101 seconds Loop type for took 0.594971 seconds
Output for 5.3.0
Loop type while took 0.507290 seconds Loop type do-while took 0.493720 seconds Loop type for took 0.526872 seconds