3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array_fill(0, 1000, 'xxxxx'); $arr2 = array_fill(0, 1000, 'xxxxx'); $runs = 100; $first = 0.0; $second = 0.0; for ($i = 0; $i < $runs; $i++) { $start = microtime(true); foreach ($arr as $value) { strpos('xxxxxxx', $value); } $end = microtime(true); $first += ($end-$start); $start = microtime(true); foreach ($arr2 as &$value2) { strpos('xxxxxxx', $value2); } $end = microtime(true); $second += ($end-$start); } print "First: " . ($first/$runs) . PHP_EOL; print "Second: " . ($second/$runs) . PHP_EOL;
Output for 7.1.0
First: 4.9281120300293E-5 Second: 5.8093070983887E-5
Output for 7.0.14
First: 5.0797462463379E-5 Second: 6.0853958129883E-5
Output for 7.0.12
First: 4.7862529754639E-5 Second: 5.6831836700439E-5
Output for 7.0.6
First: 4.5092105865479E-5 Second: 5.2845478057861E-5
Output for 7.0.5
First: 2.9199123382568E-5 Second: 3.5715103149414E-5
Output for 7.0.4
First: 4.7147274017334E-5 Second: 5.5904388427734E-5
Output for 7.0.3
First: 3.8738250732422E-5 Second: 4.7438144683838E-5
Output for 7.0.2
First: 3.8008689880371E-5 Second: 4.530668258667E-5
Output for 7.0.1
First: 4.9042701721191E-5 Second: 5.9878826141357E-5
Output for 7.0.0
First: 3.4034252166748E-5 Second: 3.9348602294922E-5
Output for 5.6.21
First: 0.00014560222625732 Second: 0.00017427921295166
Output for 5.6.20
First: 0.00014440059661865 Second: 0.00017157793045044
Output for 5.6.19
First: 0.00017882585525513 Second: 0.00020937919616699
Output for 5.6.18
First: 0.00017600297927856 Second: 0.00020078420639038
Output for 5.6.17
First: 0.00018970727920532 Second: 0.00021698713302612
Output for 5.6.16
First: 0.00013669729232788 Second: 0.00015894889831543
Output for 5.6.15
First: 0.00017798662185669 Second: 0.00020586729049683
Output for 5.6.14
First: 0.00017299175262451 Second: 0.00019691467285156
Output for 5.6.13
First: 0.00015753269195557 Second: 0.00018519163131714
Output for 5.6.12
First: 0.00017903804779053 Second: 0.00020408153533936
Output for 5.6.11
First: 0.00018775939941406 Second: 0.00021018981933594
Output for 5.6.10
First: 0.00017940998077393 Second: 0.00021434545516968
Output for 5.6.9
First: 0.00017778396606445 Second: 0.00021042346954346
Output for 5.6.8
First: 0.0001535701751709 Second: 0.00018382549285889
Output for 5.6.7
First: 0.00014746427536011 Second: 0.00017411947250366
Output for 5.6.6
First: 0.00018743515014648 Second: 0.00022276401519775
Output for 5.6.5
First: 0.00014194488525391 Second: 0.00016826868057251
Output for 5.6.4
First: 0.00016157150268555 Second: 0.00019205331802368
Output for 5.6.3
First: 0.00017795085906982 Second: 0.0002079963684082
Output for 5.6.2
First: 0.00015494585037231 Second: 0.00018215417861938
Output for 5.6.1
First: 0.00014165163040161 Second: 0.00016767740249634
Output for 5.6.0
First: 0.00013916015625 Second: 0.00016397953033447
Output for 5.5.35
First: 0.00017809867858887 Second: 0.00020895004272461
Output for 5.5.34
First: 0.00016496658325195 Second: 0.00019766092300415
Output for 5.5.33
First: 0.0001831316947937 Second: 0.00022036552429199
Output for 5.5.32
First: 0.00014219999313354 Second: 0.00016611814498901
Output for 5.5.31
First: 0.0001954984664917 Second: 0.00022823333740234
Output for 5.5.30
First: 0.00025046586990356 Second: 0.00028214693069458
Output for 5.5.29
First: 0.00016564846038818 Second: 0.00019500255584717
Output for 5.5.28
First: 0.00013948678970337 Second: 0.00016498327255249
Output for 5.5.27
First: 0.00016531944274902 Second: 0.00019402980804443
Output for 5.5.26
First: 0.000138258934021 Second: 0.0001628041267395
Output for 5.5.25
First: 0.00016253232955933 Second: 0.00019520044326782
Output for 5.5.24
First: 0.00016744613647461 Second: 0.00020015001296997
Output for 5.5.23
First: 0.00015526294708252 Second: 0.00018514633178711
Output for 5.5.22
First: 0.00016299962997437 Second: 0.00019608974456787
Output for 5.5.21
First: 0.00018190145492554 Second: 0.00021919965744019
Output for 5.5.20
First: 0.00018009424209595 Second: 0.00021263122558594
Output for 5.5.19
First: 0.00017953872680664 Second: 0.00022014379501343
Output for 5.5.18
First: 0.00015772104263306 Second: 0.0001922345161438
Output for 5.5.16
First: 0.00015462398529053 Second: 0.00018584489822388
Output for 5.5.15
First: 0.00018811702728271 Second: 0.00022198915481567
Output for 5.5.14
First: 0.00014396905899048 Second: 0.00017393589019775
Output for 5.5.13
First: 0.00017033815383911 Second: 0.00019931077957153
Output for 5.5.12
First: 0.00013858318328857 Second: 0.00016425371170044
Output for 5.5.11
First: 0.0001678204536438 Second: 0.00019537687301636
Output for 5.5.10
First: 0.000157470703125 Second: 0.0001867151260376
Output for 5.5.9
First: 0.00017027616500854 Second: 0.00020101070404053
Output for 5.5.8
First: 0.00018146991729736 Second: 0.00021467924118042
Output for 5.5.7
First: 0.00016847133636475 Second: 0.0001999044418335
Output for 5.5.6
First: 0.00017860174179077 Second: 0.00021103143692017
Output for 5.5.5
First: 0.00016999006271362 Second: 0.00020031213760376
Output for 5.5.4
First: 0.0001657247543335 Second: 0.00019674062728882
Output for 5.5.3
First: 0.00014546871185303 Second: 0.0001755690574646
Output for 5.5.2
First: 0.00015099763870239 Second: 0.00018087148666382
Output for 5.5.1
First: 0.00015389919281006 Second: 0.00018583536148071
Output for 5.5.0
First: 0.00016339540481567 Second: 0.00019381761550903
Output for 5.4.45
First: 0.0001370096206665 Second: 0.0001675271987915
Output for 5.4.44
First: 0.0001725697517395 Second: 0.00020515918731689
Output for 5.4.43
First: 0.0001414942741394 Second: 0.00016963958740234
Output for 5.4.42
First: 0.00017120122909546 Second: 0.00020910978317261
Output for 5.4.41
First: 0.00018080949783325 Second: 0.00021267175674438
Output for 5.4.40
First: 0.00016701698303223 Second: 0.0002005934715271
Output for 5.4.39
First: 0.00016813278198242 Second: 0.00019796848297119
Output for 5.4.38
First: 0.00016783475875854 Second: 0.00020275354385376
Output for 5.4.37
First: 0.00018167972564697 Second: 0.00022236585617065
Output for 5.4.36
First: 0.00018019199371338 Second: 0.00020907402038574
Output for 5.4.35
First: 0.00014701843261719 Second: 0.00017893314361572
Output for 5.4.34
First: 0.00016898155212402 Second: 0.00020685434341431
Output for 5.4.32
First: 0.00016663074493408 Second: 0.00020372629165649
Output for 5.4.31
First: 0.00018247365951538 Second: 0.00022193908691406
Output for 5.4.30
First: 0.00017159461975098 Second: 0.00020839691162109
Output for 5.4.29
First: 0.00017267465591431 Second: 0.00018090009689331
Output for 5.4.28
First: 0.00017729997634888 Second: 0.00017895221710205
Output for 5.4.27
First: 0.00015660524368286 Second: 0.00016136646270752
Output for 5.4.26
First: 0.00017631769180298 Second: 0.00018548727035522
Output for 5.4.25
First: 0.00016411304473877 Second: 0.00017518520355225
Output for 5.4.24
First: 0.00021214246749878 Second: 0.00022948980331421
Output for 5.4.23
First: 0.00018992900848389 Second: 0.00020004749298096
Output for 5.4.22
First: 0.0001600980758667 Second: 0.00017390012741089
Output for 5.4.21
First: 0.00015875101089478 Second: 0.00016896486282349
Output for 5.4.20
First: 0.00017719745635986 Second: 0.00020178556442261
Output for 5.4.19
First: 0.00018857002258301 Second: 0.00022331714630127
Output for 5.4.18
First: 0.00013185977935791 Second: 0.00015695571899414
Output for 5.4.17
First: 0.00016624450683594 Second: 0.00020266056060791
Output for 5.4.16
First: 0.00013373613357544 Second: 0.0001609206199646
Output for 5.4.15
First: 0.00017233610153198 Second: 0.00020388126373291
Output for 5.4.14
First: 0.00017024755477905 Second: 0.00020428895950317
Output for 5.4.13
First: 0.00014327764511108 Second: 0.00016592741012573
Output for 5.4.12
First: 0.00017840385437012 Second: 0.00020714998245239
Output for 5.4.11
First: 0.00016912221908569 Second: 0.00019818067550659
Output for 5.4.10
First: 0.00012331008911133 Second: 0.00014431238174438
Output for 5.4.9
First: 0.00017880439758301 Second: 0.00020717144012451
Output for 5.4.8
First: 0.000169677734375 Second: 0.00020364284515381
Output for 5.4.7
First: 0.00017636060714722 Second: 0.00021271944046021
Output for 5.4.6
First: 0.00015806198120117 Second: 0.00019087791442871
Output for 5.4.5
First: 0.00014382839202881 Second: 0.0001769232749939
Output for 5.4.4
First: 0.00015584945678711 Second: 0.00018534183502197
Output for 5.4.3
First: 0.0001740574836731 Second: 0.00020637512207031
Output for 5.4.2
First: 0.00017150402069092 Second: 0.00020312786102295
Output for 5.4.1
First: 0.00016255617141724 Second: 0.00019455194473267
Output for 5.4.0
First: 0.00013485431671143 Second: 0.00016432762145996
Output for 5.3.29
First: 0.00020995140075684 Second: 0.00025173664093018
Output for 5.3.28
First: 0.00016613245010376 Second: 0.0001994776725769
Output for 5.3.27
First: 0.00018370628356934 Second: 0.00022342920303345
Output for 5.3.26
First: 0.00017416954040527 Second: 0.00020962238311768
Output for 5.3.25
First: 0.00019606828689575 Second: 0.00023303270339966
Output for 5.3.24
First: 0.00016649723052979 Second: 0.00019626140594482
Output for 5.3.23
First: 0.0001781153678894 Second: 0.00020942687988281
Output for 5.3.22
First: 0.00020940065383911 Second: 0.00025425672531128
Output for 5.3.21
First: 0.00020117521286011 Second: 0.00024405717849731
Output for 5.3.20
First: 0.0001529598236084 Second: 0.00018309593200684
Output for 5.3.19
First: 0.00018669366836548 Second: 0.00022370100021362
Output for 5.3.18
First: 0.00021625757217407 Second: 0.00026076316833496
Output for 5.3.17
First: 0.00018450021743774 Second: 0.00022220849990845
Output for 5.3.16
First: 0.00017694473266602 Second: 0.00021232604980469
Output for 5.3.15
First: 0.00015131235122681 Second: 0.00018052339553833
Output for 5.3.14
First: 0.00016526699066162 Second: 0.00019899845123291
Output for 5.3.13
First: 0.0002573299407959 Second: 0.00031047582626343
Output for 5.3.12
First: 0.00019803047180176 Second: 0.00023781299591064
Output for 5.3.11
First: 0.00021772384643555 Second: 0.00026515007019043
Output for 5.3.10
First: 0.00021363973617554 Second: 0.00025798797607422
Output for 5.3.9
First: 0.00021722555160522 Second: 0.00025285243988037
Output for 5.3.8
First: 0.00020643472671509 Second: 0.00024320840835571
Output for 5.3.7
First: 0.00018118619918823 Second: 0.00021571159362793
Output for 5.3.6
First: 0.00022557497024536 Second: 0.00026200771331787
Output for 5.3.5
First: 0.00020764589309692 Second: 0.00025065660476685
Output for 5.3.4
First: 0.00019758701324463 Second: 0.00023347616195679
Output for 5.3.3
First: 0.00020203351974487 Second: 0.00024501085281372
Output for 5.3.2
First: 0.00017412424087524 Second: 0.00020910024642944
Output for 5.3.1
First: 0.00021407842636108 Second: 0.00025336980819702
Output for 5.3.0
First: 0.00017512798309326 Second: 0.00020866870880127
Output for 5.2.17
First: 0.00021353483200073 Second: 0.00024697542190552
Output for 5.2.16
First: 0.00018761873245239 Second: 0.00021692037582397
Output for 5.2.15
First: 0.00022336006164551 Second: 0.00025963068008423
Output for 5.2.14
First: 0.00016968965530396 Second: 0.0001946234703064
Output for 5.2.13
First: 0.00018068790435791 Second: 0.00021177291870117
Output for 5.2.12
First: 0.00026204586029053 Second: 0.00031142711639404
Output for 5.2.11
First: 0.0001717734336853 Second: 0.00020094871520996
Output for 5.2.10
First: 0.00021923065185547 Second: 0.0002651572227478
Output for 5.2.9
First: 0.00021744728088379 Second: 0.00024706840515137
Output for 5.2.8
First: 0.00017735004425049 Second: 0.00020264148712158
Output for 5.2.7
First: 0.00021534204483032 Second: 0.00024855852127075
Output for 5.2.6
First: 0.00019152164459229 Second: 0.00021997451782227
Output for 5.2.5
First: 0.00014645338058472 Second: 0.00016834497451782
Output for 5.2.4
First: 0.00021194934844971 Second: 0.00024605274200439
Output for 5.2.3
First: 0.00019517183303833 Second: 0.00022580623626709
Output for 5.2.2
First: 0.00015014886856079 Second: 0.00016857147216797
Output for 5.2.1
First: 0.00019026756286621 Second: 0.00019683122634888
Output for 5.2.0
First: 0.00021269798278809 Second: 0.00024975538253784
Output for 5.1.6
First: 0.00021204948425293 Second: 0.00023643732070923
Output for 5.1.5
First: 0.00018972873687744 Second: 0.00021982908248901
Output for 5.1.4
First: 0.00020270109176636 Second: 0.00022487878799438
Output for 5.1.3
First: 0.00014897108078003 Second: 0.00017194271087646
Output for 5.1.2
First: 0.00014940738677979 Second: 0.00017043113708496
Output for 5.1.1
First: 0.00020183563232422 Second: 0.00022589445114136
Output for 5.1.0
First: 0.00018396854400635 Second: 0.00021058320999146
Output for 5.0.5
First: 0.00036742687225342 Second: 0.00038859605789185
Output for 5.0.4
First: 0.00054024696350098 Second: 0.00058875560760498
Output for 5.0.3
First: 0.000429368019104 Second: 0.00044813632965088
Output for 5.0.2
First: 0.00040625095367432 Second: 0.00043483972549438
Output for 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/i6EvY on line 27 First: 0.00046603918075562PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/i6EvY on line 28 Second: 0.0004952597618103PHP_EOL
Output for 5.0.0
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/i6EvY on line 27 First: 0.00044748783111572PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/i6EvY on line 28 Second: 0.00046672582626343PHP_EOL
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/i6EvY on line 20
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/i6EvY on line 20
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/i6EvY on line 20
Process exited with code 255.