3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php const N = 1000; class Redis { public function run($n) { $a = rand($n, 2*$n); } } class A { protected $redis; function __construct() { $this->redis = new Redis(); } function getRedis() { return $this->redis; } function run() { for ($i = 0; $i < N; $i++) { $this->getRedis()->run($i); } } } class B { protected $redis; function __construct() { $this->redis = new Redis(); } function run() { for ($i = 0; $i < N; $i++) { $this->redis->run($i); } } } $time = microtime(true); (new A())->run(); $et1 = microtime(true) - $time; print 'Execution time with *property* accessor: ' . $et1 . PHP_EOL; $time = microtime(true); (new B())->run(); $et2 = microtime(true) - $time; print 'Execution time *without* property accessor: ' . $et2 . PHP_EOL; print 'Ratio: ' . ($et1/$et2) . PHP_EOL;
Output for 7.1.0
Execution time with *property* accessor: 0.00023794174194336 Execution time *without* property accessor: 0.00017619132995605 Ratio: 1.3504736129905
Output for 7.0.14
Execution time with *property* accessor: 0.00021600723266602 Execution time *without* property accessor: 0.00016283988952637 Ratio: 1.3265007320644
Output for 7.0.12
Execution time with *property* accessor: 0.00022101402282715 Execution time *without* property accessor: 0.00017213821411133 Ratio: 1.2839335180055
Output for 7.0.6
Execution time with *property* accessor: 0.00015616416931152 Execution time *without* property accessor: 0.00010919570922852 Ratio: 1.4301310043668
Output for 7.0.5
Execution time with *property* accessor: 0.00012302398681641 Execution time *without* property accessor: 0.0001070499420166 Ratio: 1.1492204899777
Output for 7.0.4
Execution time with *property* accessor: 0.00013613700866699 Execution time *without* property accessor: 0.00010204315185547 Ratio: 1.3341121495327
Output for 7.0.3
Execution time with *property* accessor: 0.00012898445129395 Execution time *without* property accessor: 9.7036361694336E-5 Ratio: 1.3292383292383
Output for 7.0.2
Execution time with *property* accessor: 0.00016689300537109 Execution time *without* property accessor: 0.00012612342834473 Ratio: 1.3232514177694
Output for 7.0.1
Execution time with *property* accessor: 0.00020098686218262 Execution time *without* property accessor: 0.00017094612121582 Ratio: 1.1757322175732
Output for 7.0.0
Execution time with *property* accessor: 0.00014305114746094 Execution time *without* property accessor: 0.00012397766113281 Ratio: 1.1538461538462
Output for 5.6.28
Execution time with *property* accessor: 0.0004880428314209 Execution time *without* property accessor: 0.00037980079650879 Ratio: 1.284996861268
Output for 5.6.21
Execution time with *property* accessor: 0.00040006637573242 Execution time *without* property accessor: 0.00033092498779297 Ratio: 1.2089337175793
Output for 5.6.20
Execution time with *property* accessor: 0.00049519538879395 Execution time *without* property accessor: 0.00041413307189941 Ratio: 1.195739781232
Output for 5.6.19
Execution time with *property* accessor: 0.00028514862060547 Execution time *without* property accessor: 0.00022387504577637 Ratio: 1.2736954206603
Output for 5.6.18
Execution time with *property* accessor: 0.00028896331787109 Execution time *without* property accessor: 0.00022411346435547 Ratio: 1.2893617021277
Output for 5.6.17
Execution time with *property* accessor: 0.00047206878662109 Execution time *without* property accessor: 0.00041103363037109 Ratio: 1.1484918793503
Output for 5.6.16
Execution time with *property* accessor: 0.00053691864013672 Execution time *without* property accessor: 0.00042200088500977 Ratio: 1.2723163841808
Output for 5.6.15
Execution time with *property* accessor: 0.00044798851013184 Execution time *without* property accessor: 0.00037908554077148 Ratio: 1.1817610062893
Output for 5.6.14
Execution time with *property* accessor: 0.00053000450134277 Execution time *without* property accessor: 0.00041985511779785 Ratio: 1.2623509369676
Output for 5.6.13
Execution time with *property* accessor: 0.00045084953308105 Execution time *without* property accessor: 0.00035285949707031 Ratio: 1.2777027027027
Output for 5.6.12
Execution time with *property* accessor: 0.00046300888061523 Execution time *without* property accessor: 0.00039005279541016 Ratio: 1.1870415647922
Output for 5.6.11
Execution time with *property* accessor: 0.00083494186401367 Execution time *without* property accessor: 0.00069308280944824 Ratio: 1.2046783625731
Output for 5.6.10
Execution time with *property* accessor: 0.00032615661621094 Execution time *without* property accessor: 0.0002591609954834 Ratio: 1.2585096596136
Output for 5.6.9
Execution time with *property* accessor: 0.00034403800964355 Execution time *without* property accessor: 0.00029397010803223 Ratio: 1.1703163017032
Output for 5.6.8
Execution time with *property* accessor: 0.00042295455932617 Execution time *without* property accessor: 0.00035905838012695 Ratio: 1.1779548472776
Output for 5.5.35
Execution time with *property* accessor: 0.00043082237243652 Execution time *without* property accessor: 0.00023102760314941 Ratio: 1.8648090815273
Output for 5.5.34
Execution time with *property* accessor: 0.00037193298339844 Execution time *without* property accessor: 0.00028800964355469 Ratio: 1.2913907284768
Output for 5.5.33
Execution time with *property* accessor: 0.00042486190795898 Execution time *without* property accessor: 0.00031900405883789 Ratio: 1.3318385650224
Output for 5.5.32
Execution time with *property* accessor: 0.00035190582275391 Execution time *without* property accessor: 0.00027990341186523 Ratio: 1.2572402044293
Output for 5.5.31
Execution time with *property* accessor: 0.00036406517028809 Execution time *without* property accessor: 0.00027799606323242 Ratio: 1.3096054888508
Output for 5.5.30
Execution time with *property* accessor: 0.00050592422485352 Execution time *without* property accessor: 0.00038695335388184 Ratio: 1.3074553296365
Output for 5.5.29
Execution time with *property* accessor: 0.00035595893859863 Execution time *without* property accessor: 0.00028109550476074 Ratio: 1.2663273960984
Output for 5.5.28
Execution time with *property* accessor: 0.0003509521484375 Execution time *without* property accessor: 0.00027608871459961 Ratio: 1.2711571675302
Output for 5.5.27
Execution time with *property* accessor: 0.0005650520324707 Execution time *without* property accessor: 0.00045895576477051 Ratio: 1.2311688311688
Output for 5.5.26
Execution time with *property* accessor: 0.00055098533630371 Execution time *without* property accessor: 0.00043010711669922 Ratio: 1.2810421286031
Output for 5.5.25
Execution time with *property* accessor: 0.00038003921508789 Execution time *without* property accessor: 0.00030899047851562 Ratio: 1.2299382716049
Output for 5.5.24
Execution time with *property* accessor: 0.00058412551879883 Execution time *without* property accessor: 0.00044584274291992 Ratio: 1.3101604278075
Output for 5.4.45
Execution time with *property* accessor: 0.00043892860412598 Execution time *without* property accessor: 0.0003349781036377 Ratio: 1.3103202846975
Output for 5.4.44
Execution time with *property* accessor: 0.00040411949157715 Execution time *without* property accessor: 0.00031113624572754 Ratio: 1.2988505747126
Output for 5.4.43
Execution time with *property* accessor: 0.00038695335388184 Execution time *without* property accessor: 0.00032210350036621 Ratio: 1.2013323464101
Output for 5.4.42
Execution time with *property* accessor: 0.00031089782714844 Execution time *without* property accessor: 0.00024890899658203 Ratio: 1.2490421455939
Output for 5.4.41
Execution time with *property* accessor: 0.00029206275939941 Execution time *without* property accessor: 0.00022292137145996 Ratio: 1.3101604278075
Output for 5.4.40
Execution time with *property* accessor: 0.00035810470581055 Execution time *without* property accessor: 0.00027203559875488 Ratio: 1.3163891323401
Output for 5.4.39
Execution time with *property* accessor: 0.00033903121948242 Execution time *without* property accessor: 0.00026702880859375 Ratio: 1.2696428571429
Output for 5.4.38
Execution time with *property* accessor: 0.00043892860412598 Execution time *without* property accessor: 0.00033688545227051 Ratio: 1.3029016277424
Output for 5.4.37
Execution time with *property* accessor: 0.0003211498260498 Execution time *without* property accessor: 0.00027298927307129 Ratio: 1.1764192139738
Output for 5.4.36
Execution time with *property* accessor: 0.00029897689819336 Execution time *without* property accessor: 0.0002589225769043 Ratio: 1.1546961325967
Output for 5.4.35
Execution time with *property* accessor: 0.00034284591674805 Execution time *without* property accessor: 0.00024604797363281 Ratio: 1.3934108527132
Output for 5.4.34
Execution time with *property* accessor: 0.00040388107299805 Execution time *without* property accessor: 0.00032997131347656 Ratio: 1.2239884393064
Output for 5.4.32
Execution time with *property* accessor: 0.00031185150146484 Execution time *without* property accessor: 0.00022292137145996 Ratio: 1.3989304812834
Output for 5.4.31
Execution time with *property* accessor: 0.00030398368835449 Execution time *without* property accessor: 0.00022983551025391 Ratio: 1.3226141078838
Output for 5.4.30
Execution time with *property* accessor: 0.00046706199645996 Execution time *without* property accessor: 0.00037384033203125 Ratio: 1.249362244898
Output for 5.4.29
Execution time with *property* accessor: 0.00029301643371582 Execution time *without* property accessor: 0.00022387504577637 Ratio: 1.3088391906283
Output for 5.4.28
Execution time with *property* accessor: 0.00042200088500977 Execution time *without* property accessor: 0.00034809112548828 Ratio: 1.2123287671233
Output for 5.4.27
Execution time with *property* accessor: 0.00035810470581055 Execution time *without* property accessor: 0.00027585029602051 Ratio: 1.2981849611063
Output for 5.4.26
Execution time with *property* accessor: 0.00040006637573242 Execution time *without* property accessor: 0.00030803680419922 Ratio: 1.2987616099071
Output for 5.4.25
Execution time with *property* accessor: 0.00054502487182617 Execution time *without* property accessor: 0.00041794776916504 Ratio: 1.3040501996577
Output for 5.4.24
Execution time with *property* accessor: 0.00033116340637207 Execution time *without* property accessor: 0.0002739429473877 Ratio: 1.2088772845953
Output for 5.4.23
Execution time with *property* accessor: 0.00046586990356445 Execution time *without* property accessor: 0.00036001205444336 Ratio: 1.2940397350993
Output for 5.4.22
Execution time with *property* accessor: 0.00035691261291504 Execution time *without* property accessor: 0.00027608871459961 Ratio: 1.2927461139896
Output for 5.4.21
Execution time with *property* accessor: 0.00043487548828125 Execution time *without* property accessor: 0.00037312507629395 Ratio: 1.1654952076677
Output for 5.4.20
Execution time with *property* accessor: 0.00036001205444336 Execution time *without* property accessor: 0.0002589225769043 Ratio: 1.390423572744
Output for 5.4.19
Execution time with *property* accessor: 0.0003349781036377 Execution time *without* property accessor: 0.00030398368835449 Ratio: 1.1019607843137
Output for 5.4.18
Execution time with *property* accessor: 0.00046014785766602 Execution time *without* property accessor: 0.00033688545227051 Ratio: 1.3658881811748
Output for 5.4.17
Execution time with *property* accessor: 0.00029802322387695 Execution time *without* property accessor: 0.00022101402282715 Ratio: 1.3484358144552
Output for 5.4.16
Execution time with *property* accessor: 0.00047588348388672 Execution time *without* property accessor: 0.00036501884460449 Ratio: 1.3037230568256
Output for 5.4.15
Execution time with *property* accessor: 0.0003049373626709 Execution time *without* property accessor: 0.00027894973754883 Ratio: 1.0931623931624
Output for 5.4.14
Execution time with *property* accessor: 0.00049591064453125 Execution time *without* property accessor: 0.00040388107299805 Ratio: 1.2278630460449
Output for 5.4.13
Execution time with *property* accessor: 0.0004270076751709 Execution time *without* property accessor: 0.00032186508178711 Ratio: 1.3266666666667
Output for 5.4.12
Execution time with *property* accessor: 0.00046992301940918 Execution time *without* property accessor: 0.00036406517028809 Ratio: 1.2907662082515
Output for 5.4.11
Execution time with *property* accessor: 0.00033092498779297 Execution time *without* property accessor: 0.00025081634521484 Ratio: 1.319391634981
Output for 5.4.10
Execution time with *property* accessor: 0.00028800964355469 Execution time *without* property accessor: 0.00023889541625977 Ratio: 1.2055888223553
Output for 5.4.9
Execution time with *property* accessor: 0.00046706199645996 Execution time *without* property accessor: 0.00034093856811523 Ratio: 1.3699300699301
Output for 5.4.8
Execution time with *property* accessor: 0.00045585632324219 Execution time *without* property accessor: 0.00035715103149414 Ratio: 1.2763684913218
Output for 5.4.7
Execution time with *property* accessor: 0.00030517578125 Execution time *without* property accessor: 0.00025606155395508 Ratio: 1.1918063314711
Output for 5.4.6
Execution time with *property* accessor: 0.00045204162597656 Execution time *without* property accessor: 0.00037693977355957 Ratio: 1.1992409867173
Output for 5.4.5
Execution time with *property* accessor: 0.00049686431884766 Execution time *without* property accessor: 0.00038504600524902 Ratio: 1.2904024767802
Output for 5.4.4
Execution time with *property* accessor: 0.00041103363037109 Execution time *without* property accessor: 0.00031399726867676 Ratio: 1.3090356871678
Output for 5.4.3
Execution time with *property* accessor: 0.00029683113098145 Execution time *without* property accessor: 0.0002601146697998 Ratio: 1.141154903758
Output for 5.4.2
Execution time with *property* accessor: 0.00035905838012695 Execution time *without* property accessor: 0.0002751350402832 Ratio: 1.3050259965338
Output for 5.4.1
Execution time with *property* accessor: 0.00037789344787598 Execution time *without* property accessor: 0.00030517578125 Ratio: 1.23828125
Output for 5.4.0
Execution time with *property* accessor: 0.00062894821166992 Execution time *without* property accessor: 0.00033402442932129 Ratio: 1.8829407566024
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/dcsZK on line 60
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_CONST in /in/dcsZK on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_CONST in /in/dcsZK on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/dcsZK on line 4
Process exited with code 255.