3v4l.org

run code in 500+ PHP versions simultaneously
<?php $numbers = range(0,100000); $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.0034689903259277 array_filter: 0.0050179958343506
Output for 8.5.6
foreach: 0.0037569999694824 array_filter: 0.0052108764648438
Output for 8.5.5
foreach: 0.0026209354400635 array_filter: 0.0052061080932617
Output for 8.5.4
foreach: 0.0012118816375732 array_filter: 0.0025680065155029
Output for 8.5.3
foreach: 0.0012760162353516 array_filter: 0.0025920867919922
Output for 8.5.2
foreach: 0.0012738704681396 array_filter: 0.002601146697998
Output for 8.5.1
foreach: 0.0017471313476562 array_filter: 0.0024640560150146
Output for 8.5.0
foreach: 0.001060962677002 array_filter: 0.0023858547210693
Output for 8.4.21
foreach: 0.0017681121826172 array_filter: 0.0064101219177246
Output for 8.4.20
foreach: 0.001399040222168 array_filter: 0.0032467842102051
Output for 8.4.19
foreach: 0.0014309883117676 array_filter: 0.0044820308685303
Output for 8.4.18
foreach: 0.0010828971862793 array_filter: 0.0023870468139648
Output for 8.4.17
foreach: 0.00136399269104 array_filter: 0.0029380321502686
Output for 8.4.16
foreach: 0.0012640953063965 array_filter: 0.0026450157165527
Output for 8.4.15
foreach: 0.0011341571807861 array_filter: 0.0026068687438965
Output for 8.4.14
foreach: 0.0012741088867188 array_filter: 0.0033931732177734
Output for 8.4.13
foreach: 0.0012938976287842 array_filter: 0.0032191276550293
Output for 8.4.12
foreach: 0.0011401176452637 array_filter: 0.0029289722442627
Output for 8.4.11
foreach: 0.00118088722229 array_filter: 0.0031101703643799
Output for 8.4.10
foreach: 0.001194953918457 array_filter: 0.0029289722442627
Output for 8.4.9
foreach: 0.0013449192047119 array_filter: 0.002979040145874
Output for 8.4.8
foreach: 0.0011088848114014 array_filter: 0.00343918800354
Output for 8.4.7
foreach: 0.0011880397796631 array_filter: 0.0031230449676514
Output for 8.4.6
foreach: 0.0011780261993408 array_filter: 0.0026438236236572
Output for 8.4.5
foreach: 0.0020098686218262 array_filter: 0.0031969547271729
Output for 8.4.4
foreach: 0.0011091232299805 array_filter: 0.0029480457305908
Output for 8.4.3
foreach: 0.0014879703521729 array_filter: 0.0038731098175049
Output for 8.4.2
foreach: 0.0014400482177734 array_filter: 0.003262996673584
Output for 8.4.1
foreach: 0.001093864440918 array_filter: 0.0031750202178955
Output for 8.3.31
foreach: 0.0012109279632568 array_filter: 0.0028090476989746
Output for 8.3.30
foreach: 0.00130295753479 array_filter: 0.0027201175689697
Output for 8.3.29
foreach: 0.0011401176452637 array_filter: 0.0030179023742676
Output for 8.3.28
foreach: 0.0011560916900635 array_filter: 0.0028269290924072
Output for 8.3.27
foreach: 0.0010828971862793 array_filter: 0.00341796875
Output for 8.3.26
foreach: 0.0011870861053467 array_filter: 0.0034780502319336
Output for 8.3.25
foreach: 0.0013628005981445 array_filter: 0.0032958984375
Output for 8.3.24
foreach: 0.0012691020965576 array_filter: 0.0030748844146729
Output for 8.3.23
foreach: 0.0012989044189453 array_filter: 0.0032391548156738
Output for 8.3.22
foreach: 0.0014920234680176 array_filter: 0.0035269260406494
Output for 8.3.21
foreach: 0.0013821125030518 array_filter: 0.0034019947052002
Output for 8.3.20
foreach: 0.001352071762085 array_filter: 0.0028598308563232
Output for 8.3.19
foreach: 0.001291036605835 array_filter: 0.0026900768280029
Output for 8.3.18
foreach: 0.0013210773468018 array_filter: 0.0028600692749023
Output for 8.3.17
foreach: 0.0015110969543457 array_filter: 0.0043680667877197
Output for 8.3.16
foreach: 0.0012731552124023 array_filter: 0.0034940242767334
Output for 8.3.15
foreach: 0.0013630390167236 array_filter: 0.0036008358001709
Output for 8.3.14
foreach: 0.0013887882232666 array_filter: 0.0033421516418457
Output for 8.3.13
foreach: 0.0011799335479736 array_filter: 0.0030360221862793
Output for 8.3.12
foreach: 0.0010790824890137 array_filter: 0.0032579898834229
Output for 8.3.11
foreach: 0.0010499954223633 array_filter: 0.0026190280914307
Output for 8.3.10
foreach: 0.001140832901001 array_filter: 0.003277063369751
Output for 8.3.9
foreach: 0.0012860298156738 array_filter: 0.0033071041107178
Output for 8.3.8
foreach: 0.0012211799621582 array_filter: 0.0030791759490967
Output for 8.3.7
foreach: 0.0014081001281738 array_filter: 0.0029761791229248
Output for 8.3.6
foreach: 0.0011031627655029 array_filter: 0.0025420188903809
Output for 8.3.5
foreach: 0.0012049674987793 array_filter: 0.0028419494628906
Output for 8.3.4
foreach: 0.0013871192932129 array_filter: 0.0039801597595215
Output for 8.3.3
foreach: 0.0013940334320068 array_filter: 0.0034990310668945
Output for 8.3.2
foreach: 0.001399040222168 array_filter: 0.0033659934997559
Output for 8.3.1
foreach: 0.001680850982666 array_filter: 0.0049870014190674
Output for 8.3.0
foreach: 0.0010969638824463 array_filter: 0.0041980743408203
Output for 8.2.31
foreach: 0.0012099742889404 array_filter: 0.0028760433197021

preferences:
28.3 ms | 741 KiB | 4 Q