3v4l.org

run code in 500+ PHP versions simultaneously
<?php $numbers = range(0,10000); $start = microtime(true); $found = []; foreach($numbers as $num){ if($num > 1000 && $num < 6000){ $found[] = $num; } } $end = microtime(true); echo "foreach: ".$end - $start."\n"; $start = microtime(true); function FoundValues($num){ return $num > 1000 && $num < 6000; } $found = array_filter($numbers, 'FoundValues'); $end = microtime(true); echo "array_filter: ".$end - $start;
Output for 8.5.7
foreach: 0.00030207633972168 array_filter: 0.00052499771118164
Output for 8.5.6
foreach: 0.00026607513427734 array_filter: 0.0004889965057373
Output for 8.5.5
foreach: 0.00019001960754395 array_filter: 0.00061297416687012
Output for 8.5.4
foreach: 0.00014185905456543 array_filter: 0.00029206275939941
Output for 8.5.3
foreach: 0.00018501281738281 array_filter: 0.0007021427154541
Output for 8.5.2
foreach: 0.00024890899658203 array_filter: 0.00052404403686523
Output for 8.5.1
foreach: 0.00025200843811035 array_filter: 0.00092911720275879
Output for 8.5.0
foreach: 0.00020003318786621 array_filter: 0.00029420852661133
Output for 8.4.21
foreach: 0.00012493133544922 array_filter: 0.00033903121948242
Output for 8.4.20
foreach: 0.00025606155395508 array_filter: 0.00069308280944824
Output for 8.4.19
foreach: 0.00016880035400391 array_filter: 0.00085592269897461
Output for 8.4.18
foreach: 0.00016093254089355 array_filter: 0.00062298774719238
Output for 8.4.17
foreach: 0.00018501281738281 array_filter: 0.00066995620727539
Output for 8.4.16
foreach: 0.00018095970153809 array_filter: 0.00054287910461426
Output for 8.4.15
foreach: 0.00017786026000977 array_filter: 0.00054812431335449
Output for 8.4.14
foreach: 0.00019001960754395 array_filter: 0.00062680244445801
Output for 8.4.13
foreach: 0.00033783912658691 array_filter: 0.00063300132751465
Output for 8.4.12
foreach: 0.00016593933105469 array_filter: 0.00064301490783691
Output for 8.4.11
foreach: 0.0002448558807373 array_filter: 0.00094795227050781
Output for 8.4.10
foreach: 0.0002129077911377 array_filter: 0.00049519538879395
Output for 8.4.9
foreach: 0.00017714500427246 array_filter: 0.00054597854614258
Output for 8.4.8
foreach: 0.00019311904907227 array_filter: 0.00039577484130859
Output for 8.4.7
foreach: 0.00018310546875 array_filter: 0.00054407119750977
Output for 8.4.6
foreach: 0.00016689300537109 array_filter: 0.00065088272094727
Output for 8.4.5
foreach: 0.00020217895507812 array_filter: 0.00063395500183105
Output for 8.4.4
foreach: 0.00016498565673828 array_filter: 0.00067400932312012
Output for 8.4.3
foreach: 0.00021719932556152 array_filter: 0.0006401538848877
Output for 8.4.2
foreach: 0.00019598007202148 array_filter: 0.00061488151550293
Output for 8.4.1
foreach: 0.00016307830810547 array_filter: 0.00066184997558594
Output for 8.3.31
foreach: 0.00017404556274414 array_filter: 0.0022788047790527
Output for 8.3.30
foreach: 0.00025200843811035 array_filter: 0.00061988830566406
Output for 8.3.29
foreach: 0.00018501281738281 array_filter: 0.00067615509033203
Output for 8.3.28
foreach: 0.00017404556274414 array_filter: 0.00063300132751465
Output for 8.3.27
foreach: 0.00016212463378906 array_filter: 0.00033712387084961
Output for 8.3.26
foreach: 0.00018191337585449 array_filter: 0.00055813789367676
Output for 8.3.25
foreach: 0.00019598007202148 array_filter: 0.00054192543029785
Output for 8.3.24
foreach: 0.00018596649169922 array_filter: 0.0003659725189209
Output for 8.3.23
foreach: 0.00049901008605957 array_filter: 0.0015048980712891
Output for 8.3.22
foreach: 0.00024914741516113 array_filter: 0.00068306922912598
Output for 8.3.21
foreach: 0.00018095970153809 array_filter: 0.00067496299743652
Output for 8.3.20
foreach: 0.00020885467529297 array_filter: 0.00053596496582031
Output for 8.3.19
foreach: 0.00012803077697754 array_filter: 0.00032305717468262
Output for 8.3.18
foreach: 0.00020408630371094 array_filter: 0.00062298774719238
Output for 8.3.17
foreach: 0.00034117698669434 array_filter: 0.00080490112304688
Output for 8.3.16
foreach: 0.00019407272338867 array_filter: 0.00084114074707031
Output for 8.3.15
foreach: 0.0001838207244873 array_filter: 0.0005190372467041
Output for 8.3.14
foreach: 0.00022315979003906 array_filter: 0.00058507919311523
Output for 8.3.13
foreach: 0.00016093254089355 array_filter: 0.00064492225646973
Output for 8.3.12
foreach: 0.00018405914306641 array_filter: 0.00058388710021973
Output for 8.3.11
foreach: 0.00025606155395508 array_filter: 0.00097799301147461
Output for 8.3.10
foreach: 0.0002288818359375 array_filter: 0.00066995620727539
Output for 8.3.9
foreach: 0.00022602081298828 array_filter: 0.00083279609680176
Output for 8.3.8
foreach: 0.0002291202545166 array_filter: 0.00072383880615234
Output for 8.3.7
foreach: 0.00022387504577637 array_filter: 0.00053000450134277
Output for 8.3.6
foreach: 0.0002138614654541 array_filter: 0.00049805641174316
Output for 8.3.5
foreach: 0.00017499923706055 array_filter: 0.00054812431335449
Output for 8.3.4
foreach: 0.00018000602722168 array_filter: 0.00053811073303223
Output for 8.3.3
foreach: 0.00017309188842773 array_filter: 0.00047802925109863
Output for 8.3.2
foreach: 0.0002129077911377 array_filter: 0.00052189826965332
Output for 8.3.1
foreach: 0.00035285949707031 array_filter: 0.001025915145874
Output for 8.3.0
foreach: 0.00017786026000977 array_filter: 0.00053095817565918
Output for 8.2.31
foreach: 0.00017595291137695 array_filter: 0.0006110668182373

preferences:
48.05 ms | 741 KiB | 4 Q