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 "Array: "; echo array_sum($array) / count($array); echo "\n\nObject: "; echo array_sum($obj) / count($obj);
Output for 7.1.0
Array: 0.00028406858444214 Object: 0.00052469491958618
Output for 7.0.14
Array: 0.00043444871902466 Object: 0.0006616997718811
Output for 7.0.6
Array: 0.00022900342941284 Object: 0.00045119524002075
Output for 7.0.5
Array: 0.00021141529083252 Object: 0.00041481018066406
Output for 7.0.4
Array: 0.00018459320068359 Object: 0.00036391258239746
Output for 7.0.3
Array: 0.00020286321640015 Object: 0.00040237903594971
Output for 7.0.2
Array: 0.00020717620849609 Object: 0.00043428182601929
Output for 7.0.1
Array: 0.00018524885177612 Object: 0.00038386583328247
Output for 7.0.0
Array: 0.0001953911781311 Object: 0.00038527965545654
Output for hhvm-3.12.0
Array: 0.0006198525428772 Object: 0.001354660987854
Output for hhvm-3.10.0
Array: 0.00075809478759766 Object: 0.0017310786247253
Output for 5.6.28
Array: 0.00054320096969604 Object: 0.0011484289169312
Output for 5.6.21
Array: 0.00041379451751709 Object: 0.00084159851074219
Output for 5.6.20
Array: 0.0004747748374939 Object: 0.001081805229187
Output for 5.6.19
Array: 0.0004169225692749 Object: 0.00086700916290283
Output for 5.6.18
Array: 0.00046417951583862 Object: 0.0010020518302917
Output for 5.6.17
Array: 0.00053585767745972 Object: 0.001214861869812
Output for 5.6.16
Array: 0.00042446136474609 Object: 0.00091674327850342
Output for 5.6.15
Array: 0.00041658878326416 Object: 0.00086093902587891
Output for 5.6.14
Array: 0.000446937084198 Object: 0.00092954158782959
Output for 5.6.13
Array: 0.00045278787612915 Object: 0.0009844708442688
Output for 5.6.12
Array: 0.00048638105392456 Object: 0.00098989963531494
Output for 5.6.11
Array: 0.00049146890640259 Object: 0.00095675945281982
Output for 5.6.10
Array: 0.00048953056335449 Object: 0.0010554170608521
Output for 5.6.9
Array: 0.00046700477600098 Object: 0.001020290851593
Output for 5.6.8
Array: 0.00041056394577026 Object: 0.00087592124938965
Output for 5.5.35
Array: 0.00042074918746948 Object: 0.00087975978851318
Output for 5.5.34
Array: 0.0004843544960022 Object: 0.00098272800445557
Output for 5.5.33
Array: 0.0004393458366394 Object: 0.001088809967041
Output for 5.5.32
Array: 0.00041099309921265 Object: 0.00083486795425415
Output for 5.5.31
Array: 0.00042503833770752 Object: 0.00087072610855103
Output for 5.5.30
Array: 0.00042266607284546 Object: 0.00086281538009644
Output for 5.5.29
Array: 0.00043209552764893 Object: 0.00088235139846802
Output for 5.5.28
Array: 0.00049757242202759 Object: 0.001011815071106
Output for 5.5.27
Array: 0.00043257713317871 Object: 0.00093673467636108
Output for 5.5.26
Array: 0.00042227506637573 Object: 0.00086506605148315
Output for 5.5.25
Array: 0.00045937776565552 Object: 0.00093694686889648
Output for 5.5.24
Array: 0.0004191780090332 Object: 0.00086331844329834
Output for 5.4.45
Array: 0.00036710977554321 Object: 0.00072847604751587
Output for 5.4.44
Array: 0.00038417339324951 Object: 0.0007426643371582
Output for 5.4.43
Array: 0.00040256261825562 Object: 0.00074266195297241
Output for 5.4.42
Array: 0.0005224084854126 Object: 0.0011923313140869
Output for 5.4.41
Array: 0.00041427612304687 Object: 0.00083586454391479
Output for 5.4.40
Array: 0.00043886184692383 Object: 0.00091166734695435
Output for 5.4.39
Array: 0.00036694288253784 Object: 0.00071601390838623
Output for 5.4.38
Array: 0.00054651498794556 Object: 0.0012955093383789
Output for 5.4.37
Array: 0.000538170337677 Object: 0.001210036277771
Output for 5.4.36
Array: 0.00056581974029541 Object: 0.0013183212280273
Output for 5.4.35
Array: 0.00037328243255615 Object: 0.00075223445892334
Output for 5.4.34
Array: 0.00048511505126953 Object: 0.0010642504692078
Output for 5.4.32
Array: 0.00043896436691284 Object: 0.00093942165374756
Output for 5.4.31
Array: 0.00050889015197754 Object: 0.00073613405227661
Output for 5.4.30
Array: 0.00036984920501709 Object: 0.0007132625579834
Output for 5.4.29
Array: 0.00059140920639038 Object: 0.0013478422164917
Output for 5.4.28
Array: 0.00045206546783447 Object: 0.00087428569793701
Output for 5.4.27
Array: 0.00045446157455444 Object: 0.001180853843689
Output for 5.4.26
Array: 0.00038926839828491 Object: 0.00074570894241333
Output for 5.4.25
Array: 0.00041096687316895 Object: 0.0008110499382019
Output for 5.4.24
Array: 0.00045348405838013 Object: 0.00098163604736328
Output for 5.4.23
Array: 0.0005029821395874 Object: 0.0012539315223694
Output for 5.4.22
Array: 0.00061311960220337 Object: 0.0013122630119324
Output for 5.4.21
Array: 0.00063785791397095 Object: 0.0016558575630188
Output for 5.4.20
Array: 0.00039511203765869 Object: 0.00074739456176758
Output for 5.4.19
Array: 0.00040924787521362 Object: 0.00087106227874756
Output for 5.4.18
Array: 0.00036944627761841 Object: 0.00072531938552856
Output for 5.4.17
Array: 0.00063651561737061 Object: 0.0012758588790894
Output for 5.4.16
Array: 0.00045650243759155 Object: 0.00098346948623657
Output for 5.4.15
Array: 0.00054967403411865 Object: 0.001100378036499
Output for 5.4.14
Array: 0.00036354064941406 Object: 0.00071438312530518
Output for 5.4.13
Array: 0.00057012319564819 Object: 0.0012886047363281
Output for 5.4.12
Array: 0.00046442270278931 Object: 0.0010423994064331
Output for 5.4.11
Array: 0.00038749694824219 Object: 0.00070485353469849
Output for 5.4.10
Array: 0.00044656276702881 Object: 0.0010126352310181
Output for 5.4.9
Array: 0.00036468982696533 Object: 0.00072772264480591
Output for 5.4.8
Array: 0.00055111646652222 Object: 0.0013058543205261
Output for 5.4.7
Array: 0.00038572311401367 Object: 0.0008329176902771
Output for 5.4.6
Array: 0.00050397634506226 Object: 0.0013044357299805
Output for 5.4.5
Array: 0.00045262575149536 Object: 0.0011399698257446
Output for 5.4.4
Array: 0.00045104026794434 Object: 0.0011159229278564
Output for 5.4.3
Array: 0.00036131143569946 Object: 0.00076158285140991
Output for 5.4.2
Array: 0.00050385713577271 Object: 0.0011635899543762
Output for 5.4.1
Array: 0.00038442850112915 Object: 0.00086519956588745
Output for 5.4.0
Array: 0.00041913747787476 Object: 0.00095193862915039
Output for 5.3.29
Array: 0.00059717178344727 Object: 0.0022161793708801
Output for 5.3.28
Array: 0.00086404085159302 Object: 0.002808358669281
Output for 5.3.27
Array: 0.00066927194595337 Object: 0.0019549179077148
Output for 5.3.26
Array: 0.00056007862091064 Object: 0.0016580986976624
Output for 5.3.25
Array: 0.00054572343826294 Object: 0.0016164922714233
Output for 5.3.24
Array: 0.00066125392913818 Object: 0.0020586109161377
Output for 5.3.23
Array: 0.00046390056610107 Object: 0.0012848567962646
Output for 5.3.22
Array: 0.00071096420288086 Object: 0.0020787811279297
Output for 5.3.21
Array: 0.00079847812652588 Object: 0.002315046787262
Output for 5.3.20
Array: 0.00074044227600098 Object: 0.0022507214546204
Output for 5.3.19
Array: 0.00080140590667725 Object: 0.0020763278007507
Output for 5.3.18
Array: 0.00066469430923462 Object: 0.0018574690818787
Output for 5.3.17
Array: 0.00051244974136353 Object: 0.0014028978347778
Output for 5.3.16
Array: 0.00052592754364014 Object: 0.0015262913703918
Output for 5.3.15
Array: 0.00082930326461792 Object: 0.0020364189147949
Output for 5.3.14
Array: 0.00059502840042114 Object: 0.0016727304458618
Output for 5.3.13
Array: 0.00052262783050537 Object: 0.0015080785751343
Output for 5.3.12
Array: 0.00064891338348389 Object: 0.001916618347168
Output for 5.3.11
Array: 0.00059318542480469 Object: 0.0017023944854736
Output for 5.3.10
Array: 0.00070913076400757 Object: 0.0020855355262756
Output for 5.3.9
Array: 0.00046258211135864 Object: 0.0012656998634338
Output for 5.3.8
Array: 0.00055582761764526 Object: 0.0015853381156921
Output for 5.3.7
Array: 0.00064118385314941 Object: 0.0019078469276428
Output for 5.3.6
Array: 0.00067769050598145 Object: 0.0020554351806641
Output for 5.3.5
Array: 0.00065512180328369 Object: 0.0020029664039612
Output for 5.3.4
Array: 0.00057312965393066 Object: 0.0016917061805725
Output for 5.3.3
Array: 0.0006296181678772 Object: 0.0018435668945312
Output for 5.3.2
Array: 0.00085303544998169 Object: 0.0023455333709717
Output for 5.3.1
Array: 0.00082574605941772 Object: 0.0021081352233887
Output for 5.3.0
Array: 0.00051591157913208 Object: 0.0014786124229431
Output for 5.2.17
Array: 0.001637966632843 Object: 0.0033506488800049
Output for 5.2.16
Array: 0.00089169263839722 Object: 0.0019555878639221
Output for 5.2.15
Array: 0.0012298274040222 Object: 0.0026528239250183
Output for 5.2.14
Array: 0.00074069261550903 Object: 0.0017255902290344
Output for 5.2.13
Array: 0.0006264853477478 Object: 0.0014863300323486
Output for 5.2.12
Array: 0.00094363927841187 Object: 0.0021052813529968
Output for 5.2.11
Array: 0.00092523097991943 Object: 0.0023919034004211
Output for 5.2.10
Array: 0.00091759443283081 Object: 0.0020684051513672
Output for 5.2.9
Array: 0.0010816168785095 Object: 0.002349648475647
Output for 5.2.8
Array: 0.00086640596389771 Object: 0.0019780564308167
Output for 5.2.7
Array: 0.00076220273971558 Object: 0.0017761492729187
Output for 5.2.6
Array: 0.00096725702285767 Object: 0.0021569752693176
Output for 5.2.5
Array: 0.001173300743103 Object: 0.0029376006126404
Output for 5.2.4
Array: 0.00087972164154053 Object: 0.0024806237220764
Output for 5.2.3
Array: 0.00075953245162964 Object: 0.0016880226135254
Output for 5.2.2
Array: 0.00085402250289917 Object: 0.0020821905136108
Output for 5.2.1
Array: 0.00093219041824341 Object: 0.0021145486831665
Output for 5.2.0
Array: 0.0011508989334106 Object: 0.0027641105651855
Output for 5.1.6
Array: 0.001091673374176 Object: 0.0024704265594482
Output for 5.1.5
Array: 0.00087445259094238 Object: 0.0019857716560364
Output for 5.1.4
Array: 0.00092143535614014 Object: 0.0020611667633057
Output for 5.1.3
Array: 0.00078117370605469 Object: 0.0018179202079773
Output for 5.1.2
Array: 0.00089619874954224 Object: 0.0026766204833984
Output for 5.1.1
Array: 0.00073007822036743 Object: 0.0017042231559753
Output for 5.1.0
Array: 0.00088728427886963 Object: 0.0020011568069458
Output for 5.0.5
Array: 0.0021247959136963 Object: 0.0035158967971802
Output for 5.0.4
Array: 0.0020744371414185 Object: 0.003257474899292
Output for 5.0.3
Array: 0.002199444770813 Object: 0.0041694736480713
Output for 5.0.2
Array: 0.002246265411377 Object: 0.0038398408889771
Output for 5.0.1
Array: 0.0020703387260437 Object: 0.0033744549751282
Output for 5.0.0
Array: 0.0019674968719482 Object: 0.0033070039749146
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/ASJLq 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 T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ASJLq on line 20
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/ASJLq on line 20
Process exited with code 255.