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"; $found = []; $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.0001978874206543 array_filter: 0.00029993057250977
Output for 8.5.6
foreach: 0.0003669261932373 array_filter: 0.00087094306945801
Output for 8.5.5
foreach: 0.00012493133544922 array_filter: 0.00027203559875488
Output for 8.5.4
foreach: 0.00012707710266113 array_filter: 0.00031089782714844
Output for 8.5.3
foreach: 0.00020408630371094 array_filter: 0.00040888786315918
Output for 8.5.2
foreach: 0.00017094612121582 array_filter: 0.00053882598876953
Output for 8.5.1
foreach: 0.00025582313537598 array_filter: 0.00075006484985352
Output for 8.5.0
foreach: 0.00012898445129395 array_filter: 0.00030207633972168
Output for 8.4.21
foreach: 0.00020694732666016 array_filter: 0.00051999092102051
Output for 8.4.20
foreach: 0.00012779235839844 array_filter: 0.00036001205444336
Output for 8.4.19
foreach: 0.0002598762512207 array_filter: 0.00045895576477051
Output for 8.4.18
foreach: 0.00013589859008789 array_filter: 0.00031900405883789
Output for 8.4.17
foreach: 0.00024700164794922 array_filter: 0.00051188468933105
Output for 8.4.16
foreach: 0.00019407272338867 array_filter: 0.00052714347839355
Output for 8.4.15
foreach: 0.00016093254089355 array_filter: 0.00055408477783203
Output for 8.4.14
foreach: 0.00018215179443359 array_filter: 0.00050687789916992
Output for 8.4.13
foreach: 0.00021815299987793 array_filter: 0.00064182281494141
Output for 8.4.12
foreach: 0.00016283988952637 array_filter: 0.00053596496582031
Output for 8.4.11
foreach: 0.00033307075500488 array_filter: 0.00054597854614258
Output for 8.4.10
foreach: 0.00031614303588867 array_filter: 0.00077986717224121
Output for 8.4.9
foreach: 0.00019288063049316 array_filter: 0.0003659725189209
Output for 8.4.8
foreach: 0.00026512145996094 array_filter: 0.00066494941711426
Output for 8.4.7
foreach: 0.00025296211242676 array_filter: 0.00082588195800781
Output for 8.4.6
foreach: 0.00016617774963379 array_filter: 0.00056314468383789
Output for 8.4.5
foreach: 0.00028491020202637 array_filter: 0.00067305564880371
Output for 8.4.4
foreach: 0.00031304359436035 array_filter: 0.00065302848815918
Output for 8.4.3
foreach: 0.00018501281738281 array_filter: 0.00034093856811523
Output for 8.4.2
foreach: 0.00013422966003418 array_filter: 0.00032901763916016
Output for 8.4.1
foreach: 0.0002448558807373 array_filter: 0.00059008598327637
Output for 8.3.31
foreach: 0.00016307830810547 array_filter: 0.00058603286743164
Output for 8.3.30
foreach: 0.00014996528625488 array_filter: 0.00032711029052734
Output for 8.3.29
foreach: 0.00016307830810547 array_filter: 0.00052404403686523
Output for 8.3.28
foreach: 0.00017905235290527 array_filter: 0.00046300888061523
Output for 8.3.27
foreach: 0.00019311904907227 array_filter: 0.00050020217895508
Output for 8.3.26
foreach: 0.00035500526428223 array_filter: 0.00062799453735352
Output for 8.3.25
foreach: 0.00017905235290527 array_filter: 0.0006101131439209
Output for 8.3.24
foreach: 0.00055384635925293 array_filter: 0.0012140274047852
Output for 8.3.23
foreach: 0.00016283988952637 array_filter: 0.00048208236694336
Output for 8.3.22
foreach: 0.00024318695068359 array_filter: 0.00056099891662598
Output for 8.3.21
foreach: 0.00048303604125977 array_filter: 0.00098991394042969
Output for 8.3.20
foreach: 0.00020694732666016 array_filter: 0.00056600570678711
Output for 8.3.19
foreach: 0.00020003318786621 array_filter: 0.00058889389038086
Output for 8.3.18
foreach: 0.00017690658569336 array_filter: 0.00065302848815918
Output for 8.3.17
foreach: 0.0002598762512207 array_filter: 0.00068306922912598
Output for 8.3.16
foreach: 0.00023984909057617 array_filter: 0.00068902969360352
Output for 8.3.15
foreach: 0.00035500526428223 array_filter: 0.00060606002807617
Output for 8.3.14
foreach: 0.00023603439331055 array_filter: 0.00061416625976562
Output for 8.3.13
foreach: 0.00019383430480957 array_filter: 0.00061392784118652
Output for 8.3.12
foreach: 0.0001521110534668 array_filter: 0.00034904479980469
Output for 8.3.11
foreach: 0.00019717216491699 array_filter: 0.0007479190826416
Output for 8.3.10
foreach: 0.00020623207092285 array_filter: 0.00049400329589844
Output for 8.3.9
foreach: 0.00031399726867676 array_filter: 0.00069499015808105
Output for 8.3.8
foreach: 0.00036907196044922 array_filter: 0.00090384483337402
Output for 8.3.7
foreach: 0.00024986267089844 array_filter: 0.00077509880065918
Output for 8.3.6
foreach: 0.00025081634521484 array_filter: 0.0004580020904541
Output for 8.3.5
foreach: 0.00023603439331055 array_filter: 0.00044989585876465
Output for 8.3.4
foreach: 0.00018000602722168 array_filter: 0.00064802169799805
Output for 8.3.3
foreach: 0.00020217895507812 array_filter: 0.00051212310791016
Output for 8.3.2
foreach: 0.00023198127746582 array_filter: 0.00070381164550781
Output for 8.3.1
foreach: 0.00025606155395508 array_filter: 0.00074005126953125
Output for 8.3.0
foreach: 0.00013279914855957 array_filter: 0.00032186508178711
Output for 8.2.31
foreach: 0.00026679039001465 array_filter: 0.00077295303344727

preferences:
49.95 ms | 741 KiB | 4 Q