3v4l.org

run code in 500+ PHP versions simultaneously
<?php $numbers = range(0,100000); $start = microtime(true); $justThousand = []; foreach($numbers as $num){ if($num > 1000 && $num < 6000){ $justThousand[] = $num; } } $end = microtime(true); echo "foreach: ".$end - $start."\n"; $start = microtime(true); function IsThousand($num){ return $num > 1000 && $num < 6000; } $justThousand = array_filter($numbers,'IsThousand'); $end = microtime(true); echo "array_filter: ".$end - $start;
Output for 8.5.7
foreach: 0.0022168159484863 array_filter: 0.0046918392181396
Output for 8.5.6
foreach: 0.0035591125488281 array_filter: 0.0077929496765137
Output for 8.5.5
foreach: 0.0015389919281006 array_filter: 0.0028331279754639
Output for 8.5.4
foreach: 0.0013439655303955 array_filter: 0.0028901100158691
Output for 8.5.3
foreach: 0.0012469291687012 array_filter: 0.0028200149536133
Output for 8.5.2
foreach: 0.0012791156768799 array_filter: 0.0024340152740479
Output for 8.5.1
foreach: 0.0011410713195801 array_filter: 0.0024938583374023
Output for 8.5.0
foreach: 0.0012819766998291 array_filter: 0.0022680759429932
Output for 8.4.21
foreach: 0.001209020614624 array_filter: 0.0028400421142578
Output for 8.4.20
foreach: 0.001223087310791 array_filter: 0.0030920505523682
Output for 8.4.19
foreach: 0.0012118816375732 array_filter: 0.0028030872344971
Output for 8.4.18
foreach: 0.0012798309326172 array_filter: 0.0027031898498535
Output for 8.4.17
foreach: 0.0013189315795898 array_filter: 0.003756046295166
Output for 8.4.16
foreach: 0.0013210773468018 array_filter: 0.0029439926147461
Output for 8.4.15
foreach: 0.0011820793151855 array_filter: 0.0030460357666016
Output for 8.4.14
foreach: 0.0015318393707275 array_filter: 0.0035369396209717
Output for 8.4.13
foreach: 0.001413106918335 array_filter: 0.0031139850616455
Output for 8.4.12
foreach: 0.0013818740844727 array_filter: 0.0032839775085449
Output for 8.4.11
foreach: 0.0015828609466553 array_filter: 0.0050749778747559
Output for 8.4.10
foreach: 0.0014040470123291 array_filter: 0.0029828548431396
Output for 8.4.9
foreach: 0.0022609233856201 array_filter: 0.0032219886779785
Output for 8.4.8
foreach: 0.0012099742889404 array_filter: 0.0032479763031006
Output for 8.4.7
foreach: 0.0012509822845459 array_filter: 0.0035769939422607
Output for 8.4.6
foreach: 0.0011918544769287 array_filter: 0.0034348964691162
Output for 8.4.5
foreach: 0.0011880397796631 array_filter: 0.0030570030212402
Output for 8.4.4
foreach: 0.0012650489807129 array_filter: 0.0031290054321289
Output for 8.4.3
foreach: 0.001190185546875 array_filter: 0.0033040046691895
Output for 8.4.2
foreach: 0.0012631416320801 array_filter: 0.0029380321502686
Output for 8.4.1
foreach: 0.0012609958648682 array_filter: 0.0031459331512451
Output for 8.3.31
foreach: 0.0011229515075684 array_filter: 0.0030608177185059
Output for 8.3.30
foreach: 0.0012760162353516 array_filter: 0.0032370090484619
Output for 8.3.29
foreach: 0.0013108253479004 array_filter: 0.0028531551361084
Output for 8.3.28
foreach: 0.0013718605041504 array_filter: 0.0036489963531494
Output for 8.3.27
foreach: 0.0013468265533447 array_filter: 0.0032298564910889
Output for 8.3.26
foreach: 0.0015671253204346 array_filter: 0.0033481121063232
Output for 8.3.25
foreach: 0.0012969970703125 array_filter: 0.0030519962310791
Output for 8.3.24
foreach: 0.001349925994873 array_filter: 0.0030958652496338
Output for 8.3.23
foreach: 0.0012969970703125 array_filter: 0.0029709339141846
Output for 8.3.22
foreach: 0.0012688636779785 array_filter: 0.0036869049072266
Output for 8.3.21
foreach: 0.0013618469238281 array_filter: 0.0027968883514404
Output for 8.3.20
foreach: 0.0014429092407227 array_filter: 0.0036499500274658
Output for 8.3.19
foreach: 0.0013589859008789 array_filter: 0.0030920505523682
Output for 8.3.18
foreach: 0.0012037754058838 array_filter: 0.0034401416778564
Output for 8.3.17
foreach: 0.0016560554504395 array_filter: 0.0042629241943359
Output for 8.3.16
foreach: 0.0011501312255859 array_filter: 0.0031108856201172
Output for 8.3.15
foreach: 0.0012989044189453 array_filter: 0.003046989440918
Output for 8.3.14
foreach: 0.0015809535980225 array_filter: 0.0049810409545898
Output for 8.3.13
foreach: 0.0013010501861572 array_filter: 0.0033800601959229
Output for 8.3.12
foreach: 0.0015749931335449 array_filter: 0.0049219131469727
Output for 8.3.11
foreach: 0.0016570091247559 array_filter: 0.0043900012969971
Output for 8.3.10
foreach: 0.0010628700256348 array_filter: 0.0026400089263916
Output for 8.3.9
foreach: 0.0010969638824463 array_filter: 0.0026910305023193
Output for 8.3.8
foreach: 0.0012960433959961 array_filter: 0.0032310485839844
Output for 8.3.7
foreach: 0.0011870861053467 array_filter: 0.0032060146331787
Output for 8.3.6
foreach: 0.0012569427490234 array_filter: 0.0033650398254395
Output for 8.3.5
foreach: 0.0012590885162354 array_filter: 0.0036911964416504
Output for 8.3.4
foreach: 0.0011789798736572 array_filter: 0.0029349327087402
Output for 8.3.3
foreach: 0.0012261867523193 array_filter: 0.0027999877929688
Output for 8.3.2
foreach: 0.001209020614624 array_filter: 0.0034399032592773
Output for 8.3.1
foreach: 0.0015339851379395 array_filter: 0.0030779838562012
Output for 8.3.0
foreach: 0.0014879703521729 array_filter: 0.0032470226287842
Output for 8.2.31
foreach: 0.0011279582977295 array_filter: 0.0041089057922363

preferences:
40.53 ms | 741 KiB | 4 Q