3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** * My results: * * Average time to process 10,000 items, 100 runs * * Array:: 0.0034920692443848 * Obj: 0.026956255435944 */ /** * Class foo */ class Foo { /** * @var */ protected $bar; /** * Builds it. * * @param mixed $bar * Something bar */ public function __construct($bar) { $this->bar = $bar; } /** * Something. * * @return mixed * Something */ public function getBar() { return $this->bar; } } $foo['bar'] = 'baz'; $baz = new Foo('baz'); $cycles = 10000; $array = $obj = array(); for ($j = 0; $j < 100; $j++) { $start = microtime(TRUE); for ($i = 0; $i < $cycles; $i++) { $b = $foo['bar']; } $array[] = microtime(TRUE) - $start; $start = microtime(TRUE); for ($i = 0; $i < $cycles; $i++) { $b = $baz->getBar(); } $obj[] = microtime(TRUE) - $start; } echo "Arr: "; echo array_sum($array) / count($array); echo "\n\nObj: "; echo array_sum($obj) / count($obj);
Output for 7.1.0
Arr: 0.00027984380722046 Obj: 0.00052129983901978
Output for 7.0.14
Arr: 0.00041420698165894 Obj: 0.00063642740249634
Output for 7.0.10
Arr: 0.00024545669555664 Obj: 0.00049059629440308
Output for 7.0.9
Arr: 0.00018336057662964 Obj: 0.00036714315414429
Output for 7.0.8
Arr: 0.00019350051879883 Obj: 0.00036880731582642
Output for 7.0.7
Arr: 0.00018332481384277 Obj: 0.00037930488586426
Output for 7.0.6
Arr: 0.00018728494644165 Obj: 0.00036643266677856
Output for 7.0.5
Arr: 0.00018479347229004 Obj: 0.00036332368850708
Output for 7.0.4
Arr: 0.0001907205581665 Obj: 0.00036871194839478
Output for 7.0.3
Arr: 0.00026976585388184 Obj: 0.00053513765335083
Output for 7.0.2
Arr: 0.00022619247436523 Obj: 0.00044924736022949
Output for 7.0.1
Arr: 0.00022498369216919 Obj: 0.00043980598449707
Output for 7.0.0
Arr: 0.00020332813262939 Obj: 0.00039538621902466
Output for hhvm-3.12.0
Arr: 0.00086683750152588 Obj: 0.001908860206604
Output for hhvm-3.10.0
Arr: 0.0011314868927002 Obj: 0.002544219493866
Output for 5.6.28
Arr: 0.00055094957351685 Obj: 0.0011646151542664
Output for 5.6.25
Arr: 0.00051474571228027 Obj: 0.0010605096817017
Output for 5.6.24
Arr: 0.00044125556945801 Obj: 0.00092509746551514
Output for 5.6.23
Arr: 0.00043020486831665 Obj: 0.00090903282165527
Output for 5.6.22
Arr: 0.00042040109634399 Obj: 0.00087384462356567
Output for 5.6.21
Arr: 0.0004191255569458 Obj: 0.00093261241912842
Output for 5.6.20
Arr: 0.00042982578277588 Obj: 0.00088948011398315
Output for 5.6.19
Arr: 0.00043748378753662 Obj: 0.00092443466186523
Output for 5.6.18
Arr: 0.00041503190994263 Obj: 0.00087720394134521
Output for 5.6.17
Arr: 0.00045403003692627 Obj: 0.00097437858581543
Output for 5.6.16
Arr: 0.00051867723464966 Obj: 0.001077938079834
Output for 5.6.15
Arr: 0.00047408580780029 Obj: 0.0010415649414063
Output for 5.6.14
Arr: 0.00046491861343384 Obj: 0.0009607195854187
Output for 5.6.13
Arr: 0.00045226097106934 Obj: 0.0009676194190979
Output for 5.6.12
Arr: 0.00053122282028198 Obj: 0.0011165904998779
Output for 5.6.11
Arr: 0.00047563314437866 Obj: 0.00097606182098389
Output for 5.6.10
Arr: 0.00053141832351685 Obj: 0.0010849976539612
Output for 5.6.9
Arr: 0.00058161973953247 Obj: 0.0011344766616821
Output for 5.6.8
Arr: 0.0004560923576355 Obj: 0.00096181631088257
Output for 5.6.7
Arr: 0.00060974359512329 Obj: 0.001288788318634
Output for 5.6.6
Arr: 0.00064472198486328 Obj: 0.0013855004310608
Output for 5.6.5
Arr: 0.00045639991760254 Obj: 0.00094937801361084
Output for 5.6.4
Arr: 0.00045218706130981 Obj: 0.00097335338592529
Output for 5.6.3
Arr: 0.00051962614059448 Obj: 0.0010584783554077
Output for 5.6.2
Arr: 0.00047388553619385 Obj: 0.00097375631332397
Output for 5.6.1
Arr: 0.0005048131942749 Obj: 0.0010361218452454
Output for 5.6.0
Arr: 0.00051514863967896 Obj: 0.0010402321815491
Output for 5.5.38
Arr: 0.00065334796905518 Obj: 0.0013262009620667
Output for 5.5.37
Arr: 0.00057624578475952 Obj: 0.0011584734916687
Output for 5.5.36
Arr: 0.00040075778961182 Obj: 0.00090938091278076
Output for 5.5.35
Arr: 0.00043775081634521 Obj: 0.00089019298553467
Output for 5.5.34
Arr: 0.00045187473297119 Obj: 0.00092678785324097
Output for 5.5.33
Arr: 0.0004217791557312 Obj: 0.00088581800460815
Output for 5.5.32
Arr: 0.0004455304145813 Obj: 0.00092574119567871
Output for 5.5.31
Arr: 0.00049695253372192 Obj: 0.0010473465919495
Output for 5.5.30
Arr: 0.00049237728118896 Obj: 0.00099864721298218
Output for 5.5.29
Arr: 0.00042893648147583 Obj: 0.00087939023971558
Output for 5.5.28
Arr: 0.00044648170471191 Obj: 0.00089782953262329
Output for 5.5.27
Arr: 0.00048747777938843 Obj: 0.0010207486152649
Output for 5.5.26
Arr: 0.00048640489578247 Obj: 0.00098844766616821
Output for 5.5.25
Arr: 0.00053830146789551 Obj: 0.0010960459709167
Output for 5.5.24
Arr: 0.00045523166656494 Obj: 0.00093605995178223
Output for 5.5.23
Arr: 0.00058178901672363 Obj: 0.0013529086112976
Output for 5.5.22
Arr: 0.00053208351135254 Obj: 0.0012465739250183
Output for 5.5.21
Arr: 0.00052879333496094 Obj: 0.0010808920860291
Output for 5.5.20
Arr: 0.00057292938232422 Obj: 0.0011759209632874
Output for 5.5.19
Arr: 0.00065762281417847 Obj: 0.0013433742523193
Output for 5.5.18
Arr: 0.00052322864532471 Obj: 0.0010484933853149
Output for 5.5.16
Arr: 0.00059642791748047 Obj: 0.0012427735328674
Output for 5.5.15
Arr: 0.00049862623214722 Obj: 0.00099055528640747
Output for 5.5.14
Arr: 0.00072174549102783 Obj: 0.0013744950294495
Output for 5.5.13
Arr: 0.00046336889266968 Obj: 0.00094839572906494
Output for 5.5.12
Arr: 0.00047056198120117 Obj: 0.00096397161483765
Output for 5.5.11
Arr: 0.0004835844039917 Obj: 0.0010526156425476
Output for 5.5.10
Arr: 0.00064782857894897 Obj: 0.0013328576087952
Output for 5.5.9
Arr: 0.00049661874771118 Obj: 0.001066267490387
Output for 5.5.8
Arr: 0.00051283121109009 Obj: 0.0010877990722656
Output for 5.5.7
Arr: 0.00044717311859131 Obj: 0.00090709447860718
Output for 5.5.6
Arr: 0.00050744533538818 Obj: 0.0011278319358826
Output for 5.5.5
Arr: 0.00056269884109497 Obj: 0.0011432981491089
Output for 5.5.4
Arr: 0.00057960271835327 Obj: 0.0011597681045532
Output for 5.5.3
Arr: 0.00046204805374146 Obj: 0.00097836494445801
Output for 5.5.2
Arr: 0.00053861618041992 Obj: 0.0011262607574463
Output for 5.5.1
Arr: 0.00068519353866577 Obj: 0.0014116191864014
Output for 5.5.0
Arr: 0.00054706335067749 Obj: 0.0010521149635315
Output for 5.4.45
Arr: 0.00053309202194214 Obj: 0.0010364675521851
Output for 5.4.44
Arr: 0.0004776930809021 Obj: 0.00093812942504883
Output for 5.4.43
Arr: 0.00052150249481201 Obj: 0.00099878311157227
Output for 5.4.42
Arr: 0.00056262016296387 Obj: 0.0010952186584473
Output for 5.4.41
Arr: 0.00056018352508545 Obj: 0.0010850954055786
Output for 5.4.40
Arr: 0.0005057168006897 Obj: 0.00097204446792603
Output for 5.4.39
Arr: 0.00046379804611206 Obj: 0.00091597318649292
Output for 5.4.38
Arr: 0.00052121877670288 Obj: 0.0010259437561035
Output for 5.4.37
Arr: 0.00055839061737061 Obj: 0.0010880494117737
Output for 5.4.36
Arr: 0.00048892498016357 Obj: 0.00094421863555908
Output for 5.4.35
Arr: 0.0004716968536377 Obj: 0.00092828989028931
Output for 5.4.34
Arr: 0.00056934356689453 Obj: 0.0010826230049133
Output for 5.4.32
Arr: 0.00055969476699829 Obj: 0.0010897374153137
Output for 5.4.31
Arr: 0.00048243522644043 Obj: 0.00091714143753052
Output for 5.4.30
Arr: 0.00047285318374634 Obj: 0.00092703104019165
Output for 5.4.29
Arr: 0.00052742004394531 Obj: 0.00095542669296265
Output for 5.4.28
Arr: 0.00055590152740479 Obj: 0.0010675668716431
Output for 5.4.27
Arr: 0.00048562526702881 Obj: 0.00094326734542847
Output for 5.4.26
Arr: 0.00053797960281372 Obj: 0.0010381531715393
Output for 5.4.25
Arr: 0.00049378156661987 Obj: 0.00097065448760986
Output for 5.4.24
Arr: 0.00051963329315186 Obj: 0.0010085821151733
Output for 5.4.23
Arr: 0.00055374383926392 Obj: 0.0010620903968811
Output for 5.4.22
Arr: 0.00057129383087158 Obj: 0.0011013722419739
Output for 5.4.21
Arr: 0.0005135178565979 Obj: 0.00091701984405518
Output for 5.4.20
Arr: 0.00051755428314209 Obj: 0.0010018014907837
Output for 5.4.19
Arr: 0.00047676563262939 Obj: 0.00093369245529175
Output for 5.4.18
Arr: 0.00051630258560181 Obj: 0.00091138601303101
Output for 5.4.17
Arr: 0.00047834157943726 Obj: 0.00093740940093994
Output for 5.4.16
Arr: 0.00055192470550537 Obj: 0.0010890889167786
Output for 5.4.15
Arr: 0.00050114631652832 Obj: 0.00098719835281372
Output for 5.4.14
Arr: 0.00060055494308472 Obj: 0.0012065291404724
Output for 5.4.13
Arr: 0.00051213979721069 Obj: 0.001004626750946
Output for 5.4.12
Arr: 0.00056843757629395 Obj: 0.0011303853988647
Output for 5.4.11
Arr: 0.00056432485580444 Obj: 0.0010480165481567
Output for 5.4.10
Arr: 0.00044926404953003 Obj: 0.00088914632797241
Output for 5.4.9
Arr: 0.00047864675521851 Obj: 0.00092807531356812
Output for 5.4.8
Arr: 0.00051410913467407 Obj: 0.0011786794662476
Output for 5.4.7
Arr: 0.00044000148773193 Obj: 0.0008795952796936
Output for 5.4.6
Arr: 0.00048785448074341 Obj: 0.00094622373580933
Output for 5.4.5
Arr: 0.00048461437225342 Obj: 0.0011216616630554
Output for 5.4.4
Arr: 0.0004514741897583 Obj: 0.0009765887260437
Output for 5.4.3
Arr: 0.00052480220794678 Obj: 0.0011581754684448
Output for 5.4.2
Arr: 0.00046205282211304 Obj: 0.00090807199478149
Output for 5.4.1
Arr: 0.00042763471603394 Obj: 0.00087576866149902
Output for 5.4.0
Arr: 0.00052654981613159 Obj: 0.0012060403823853
Output for 5.3.29
Arr: 0.00056646108627319 Obj: 0.0016958165168762
Output for 5.3.28
Arr: 0.00056723117828369 Obj: 0.001692111492157
Output for 5.3.27
Arr: 0.00067652702331543 Obj: 0.0020312237739563
Output for 5.3.26
Arr: 0.0006871223449707 Obj: 0.0020956945419312
Output for 5.3.25
Arr: 0.0006291937828064 Obj: 0.0018589687347412
Output for 5.3.24
Arr: 0.00060548543930054 Obj: 0.0018068790435791
Output for 5.3.23
Arr: 0.00061150789260864 Obj: 0.0018379807472229
Output for 5.3.22
Arr: 0.00055410146713257 Obj: 0.0016145610809326
Output for 5.3.21
Arr: 0.00058160066604614 Obj: 0.0017238163948059
Output for 5.3.20
Arr: 0.00060834407806396 Obj: 0.0021516132354736
Output for 5.3.19
Arr: 0.00057756423950195 Obj: 0.001671724319458
Output for 5.3.18
Arr: 0.00062926530838013 Obj: 0.001749963760376
Output for 5.3.17
Arr: 0.00057393312454224 Obj: 0.0016789817810059
Output for 5.3.16
Arr: 0.00063608169555664 Obj: 0.0018879318237305
Output for 5.3.15
Arr: 0.00056568622589111 Obj: 0.0016774749755859
Output for 5.3.14
Arr: 0.00061614274978638 Obj: 0.0017332315444946
Output for 5.3.13
Arr: 0.00060594081878662 Obj: 0.0017568731307983
Output for 5.3.12
Arr: 0.0005608344078064 Obj: 0.0016646933555603
Output for 5.3.11
Arr: 0.0005711841583252 Obj: 0.001693799495697
Output for 5.3.10
Arr: 0.00066153287887573 Obj: 0.0018654632568359
Output for 5.3.9
Arr: 0.00062825679779053 Obj: 0.0017924022674561
Output for 5.3.8
Arr: 0.00070133447647095 Obj: 0.0016472744941711
Output for 5.3.7
Arr: 0.00057248830795288 Obj: 0.001644458770752
Output for 5.3.6
Arr: 0.00057560205459595 Obj: 0.001725070476532
Output for 5.3.5
Arr: 0.00057878255844116 Obj: 0.001679322719574
Output for 5.3.4
Arr: 0.00060019254684448 Obj: 0.0017621088027954
Output for 5.3.3
Arr: 0.00060003995895386 Obj: 0.0016842293739319
Output for 5.3.2
Arr: 0.00058461427688599 Obj: 0.0016826200485229
Output for 5.3.1
Arr: 0.00045857906341553 Obj: 0.0013261246681213
Output for 5.3.0
Arr: 0.00056084156036377 Obj: 0.0016076874732971
Output for 5.2.17
Arr: 0.00081777334213257 Obj: 0.0021519899368286
Output for 5.2.16
Arr: 0.00081983089447021 Obj: 0.0021122121810913
Output for 5.2.15
Arr: 0.0008511209487915 Obj: 0.0021197462081909
Output for 5.2.14
Arr: 0.00078180313110352 Obj: 0.0019970107078552
Output for 5.2.13
Arr: 0.0007399320602417 Obj: 0.0019087409973145
Output for 5.2.12
Arr: 0.00075161218643188 Obj: 0.0018789196014404
Output for 5.2.11
Arr: 0.00074896097183228 Obj: 0.0019239664077759
Output for 5.2.10
Arr: 0.00064192056655884 Obj: 0.0017885994911194
Output for 5.2.9
Arr: 0.00077900886535645 Obj: 0.0019147062301636
Output for 5.2.8
Arr: 0.00076817512512207 Obj: 0.0019501996040344
Output for 5.2.7
Arr: 0.00078137874603271 Obj: 0.0019762682914734
Output for 5.2.6
Arr: 0.00078535556793213 Obj: 0.0019293117523193
Output for 5.2.5
Arr: 0.00077272415161133 Obj: 0.0019609379768372
Output for 5.2.4
Arr: 0.00080656051635742 Obj: 0.0019766235351562
Output for 5.2.3
Arr: 0.00077729225158691 Obj: 0.0019024443626404
Output for 5.2.2
Arr: 0.00076730251312256 Obj: 0.0019454145431519
Output for 5.2.1
Arr: 0.00072213411331177 Obj: 0.0018263220787048
Output for 5.2.0
Arr: 0.00063426733016968 Obj: 0.00156094789505
Output for 5.1.6
Arr: 0.00073144435882568 Obj: 0.0018425631523132
Output for 5.1.5
Arr: 0.00086021661758423 Obj: 0.0022232532501221
Output for 5.1.4
Arr: 0.00073849439620972 Obj: 0.0019169664382935
Output for 5.1.3
Arr: 0.00082122325897217 Obj: 0.0021826839447021
Output for 5.1.2
Arr: 0.00082371711730957 Obj: 0.0021571660041809
Output for 5.1.1
Arr: 0.00087063074111938 Obj: 0.0022026419639587
Output for 5.1.0
Arr: 0.00082054376602173 Obj: 0.0021705389022827
Output for 5.0.5
Arr: 0.0019804167747498 Obj: 0.003413028717041
Output for 5.0.4
Arr: 0.0018576097488403 Obj: 0.0031495332717896
Output for 5.0.3
Arr: 0.0018069291114807 Obj: 0.0030597972869873
Output for 5.0.2
Arr: 0.0017992854118347 Obj: 0.0031034708023071
Output for 5.0.1
Arr: 0.0018815112113953 Obj: 0.0032434368133545
Output for 5.0.0
Arr: 0.0018947577476501 Obj: 0.003390064239502
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/UnDgA on line 21
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/UnDgA on line 21
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/UnDgA on line 21
Process exited with code 255.