3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { protected $bar = 'baz'; public function getBar() { return $this->bar; } } $foo = new Foo; $time = microtime(true); for ($i = 0; $i <= 10000; $i++) { $ref = new ReflectionClass($foo); $property = $ref->getProperty('bar'); $property->setAccessible(true); $property->getValue($foo); } echo "REFLECTION: ", microtime(true) - $time, PHP_EOL; $time = microtime(true); for ($i = 0; $i <= 10000; $i++) { $foo->getBar(); } echo "GETTER: ", microtime(true) - $time, PHP_EOL;
based on oOsIi
Output for 7.1.0
REFLECTION: 0.011187076568604 GETTER: 0.00053310394287109
Output for 7.0.14
REFLECTION: 0.010829210281372 GETTER: 0.0005650520324707
Output for 7.0.6
REFLECTION: 0.0070030689239502 GETTER: 0.00041890144348145
Output for 7.0.5
REFLECTION: 0.0083780288696289 GETTER: 0.00052499771118164
Output for 7.0.4
REFLECTION: 0.0065300464630127 GETTER: 0.00038313865661621
Output for 7.0.3
REFLECTION: 0.0057668685913086 GETTER: 0.00034880638122559
Output for 7.0.2
REFLECTION: 0.0082681179046631 GETTER: 0.00049805641174316
Output for 7.0.1
REFLECTION: 0.0090668201446533 GETTER: 0.00040197372436523
Output for 7.0.0
REFLECTION: 0.0056478977203369 GETTER: 0.0003509521484375
Output for hhvm-3.12.0
REFLECTION: 0.21580600738525 GETTER: 0.0020699501037598
Output for hhvm-3.10.0
REFLECTION: 0.043748140335083 GETTER: 0.0017509460449219
Output for 5.6.28
REFLECTION: 0.018877983093262 GETTER: 0.001288890838623
Output for 5.6.21
REFLECTION: 0.013090848922729 GETTER: 0.00096893310546875
Output for 5.6.20
REFLECTION: 0.010311126708984 GETTER: 0.00081801414489746
Output for 5.6.19
REFLECTION: 0.01012110710144 GETTER: 0.00079703330993652
Output for 5.6.18
REFLECTION: 0.012712955474854 GETTER: 0.00088882446289062
Output for 5.6.17
REFLECTION: 0.0098719596862793 GETTER: 0.00076794624328613
Output for 5.6.16
REFLECTION: 0.015350103378296 GETTER: 0.0012540817260742
Output for 5.6.15
REFLECTION: 0.0096569061279297 GETTER: 0.00075602531433105
Output for 5.6.14
REFLECTION: 0.0140221118927 GETTER: 0.0011560916900635
Output for 5.6.13
REFLECTION: 0.010517120361328 GETTER: 0.00084590911865234
Output for 5.6.12
REFLECTION: 0.015227079391479 GETTER: 0.0014159679412842
Output for 5.6.11
REFLECTION: 0.015830993652344 GETTER: 0.0011951923370361
Output for 5.6.10
REFLECTION: 0.014573812484741 GETTER: 0.0011739730834961
Output for 5.6.9
REFLECTION: 0.012073993682861 GETTER: 0.00094294548034668
Output for 5.6.8
REFLECTION: 0.0123450756073 GETTER: 0.00089788436889648
Output for 5.5.35
REFLECTION: 0.01487398147583 GETTER: 0.001121997833252
Output for 5.5.34
REFLECTION: 0.010267019271851 GETTER: 0.00079703330993652
Output for 5.5.33
REFLECTION: 0.010501146316528 GETTER: 0.00081491470336914
Output for 5.5.32
REFLECTION: 0.015971899032593 GETTER: 0.0011489391326904
Output for 5.5.31
REFLECTION: 0.010396957397461 GETTER: 0.00080513954162598
Output for 5.5.30
REFLECTION: 0.015902042388916 GETTER: 0.0011491775512695
Output for 5.5.29
REFLECTION: 0.015051126480103 GETTER: 0.0011279582977295
Output for 5.5.28
REFLECTION: 0.014986991882324 GETTER: 0.0011599063873291
Output for 5.5.27
REFLECTION: 0.01088809967041 GETTER: 0.00084209442138672
Output for 5.5.26
REFLECTION: 0.012733936309814 GETTER: 0.00088906288146973
Output for 5.5.25
REFLECTION: 0.015411138534546 GETTER: 0.0011031627655029
Output for 5.5.24
REFLECTION: 0.009800910949707 GETTER: 0.00076484680175781
Output for 5.4.45
REFLECTION: 0.028291940689087 GETTER: 0.00130295753479
Output for 5.4.44
REFLECTION: 0.014948129653931 GETTER: 0.0014350414276123
Output for 5.4.43
REFLECTION: 0.049309968948364 GETTER: 0.001384973526001
Output for 5.4.42
REFLECTION: 0.017709016799927 GETTER: 0.0015761852264404
Output for 5.4.41
REFLECTION: 0.0099458694458008 GETTER: 0.0010800361633301
Output for 5.4.40
REFLECTION: 0.015762090682983 GETTER: 0.0011618137359619
Output for 5.4.39
REFLECTION: 0.016726970672607 GETTER: 0.0013961791992188
Output for 5.4.38
REFLECTION: 0.036524057388306 GETTER: 0.0031938552856445
Output for 5.4.37
REFLECTION: 0.015897035598755 GETTER: 0.0012469291687012
Output for 5.4.36
REFLECTION: 0.026798009872437 GETTER: 0.0025849342346191
Output for 5.4.35
REFLECTION: 0.01823091506958 GETTER: 0.0012772083282471
Output for 5.4.34
REFLECTION: 0.038256883621216 GETTER: 0.0010879039764404
Output for 5.4.32
REFLECTION: 0.01279616355896 GETTER: 0.00084590911865234
Output for 5.4.31
REFLECTION: 0.012531995773315 GETTER: 0.00088810920715332
Output for 5.4.30
REFLECTION: 0.012383937835693 GETTER: 0.00088191032409668
Output for 5.4.29
REFLECTION: 0.013513803482056 GETTER: 0.0010020732879639
Output for 5.4.28
REFLECTION: 0.013601064682007 GETTER: 0.00086593627929688
Output for 5.4.27
REFLECTION: 0.015516996383667 GETTER: 0.00083589553833008
Output for 5.4.26
REFLECTION: 0.013720989227295 GETTER: 0.00090193748474121
Output for 5.4.25
REFLECTION: 0.012727975845337 GETTER: 0.0010740756988525
Output for 5.4.24
REFLECTION: 0.015272855758667 GETTER: 0.00089001655578613
Output for 5.4.23
REFLECTION: 0.013645172119141 GETTER: 0.00084805488586426
Output for 5.4.22
REFLECTION: 0.014379024505615 GETTER: 0.00083708763122559
Output for 5.4.21
REFLECTION: 0.012462854385376 GETTER: 0.0008540153503418
Output for 5.4.20
REFLECTION: 0.01477313041687 GETTER: 0.00093483924865723
Output for 5.4.19
REFLECTION: 0.0156409740448 GETTER: 0.0010161399841309
Output for 5.4.18
REFLECTION: 0.014585971832275 GETTER: 0.00091910362243652
Output for 5.4.17
REFLECTION: 0.013965129852295 GETTER: 0.00096297264099121
Output for 5.4.16
REFLECTION: 0.0140700340271 GETTER: 0.00085711479187012
Output for 5.4.15
REFLECTION: 0.013334989547729 GETTER: 0.00093889236450195
Output for 5.4.14
REFLECTION: 0.013067007064819 GETTER: 0.0008690357208252
Output for 5.4.13
REFLECTION: 0.013529777526855 GETTER: 0.00086498260498047
Output for 5.4.12
REFLECTION: 0.013124942779541 GETTER: 0.00090909004211426
Output for 5.4.11
REFLECTION: 0.01334285736084 GETTER: 0.00092887878417969
Output for 5.4.10
REFLECTION: 0.013949155807495 GETTER: 0.00081086158752441
Output for 5.4.9
REFLECTION: 0.014255046844482 GETTER: 0.0014369487762451
Output for 5.4.8
REFLECTION: 0.013490915298462 GETTER: 0.00087404251098633
Output for 5.4.7
REFLECTION: 0.013001918792725 GETTER: 0.0010278224945068
Output for 5.4.6
REFLECTION: 0.013403177261353 GETTER: 0.00092697143554688
Output for 5.4.5
REFLECTION: 0.013244867324829 GETTER: 0.00078797340393066
Output for 5.4.4
REFLECTION: 0.014424085617065 GETTER: 0.00082588195800781
Output for 5.4.3
REFLECTION: 0.015358924865723 GETTER: 0.00080990791320801
Output for 5.4.2
REFLECTION: 0.013686895370483 GETTER: 0.00084209442138672
Output for 5.4.1
REFLECTION: 0.014089822769165 GETTER: 0.00081300735473633
Output for 5.4.0
REFLECTION: 0.014912128448486 GETTER: 0.00090718269348145
Output for 5.3.29
REFLECTION: 0.016630887985229 GETTER: 0.0015249252319336
Output for 5.3.28
REFLECTION: 0.017802953720093 GETTER: 0.0016148090362549
Output for 5.3.27
REFLECTION: 0.019317150115967 GETTER: 0.0015740394592285
Output for 5.3.26
REFLECTION: 0.01737904548645 GETTER: 0.0018110275268555
Output for 5.3.25
REFLECTION: 0.016951084136963 GETTER: 0.0017030239105225
Output for 5.3.24
REFLECTION: 0.018256187438965 GETTER: 0.0016250610351562
Output for 5.3.23
REFLECTION: 0.018516063690186 GETTER: 0.0018389225006104
Output for 5.3.22
REFLECTION: 0.017273187637329 GETTER: 0.0015530586242676
Output for 5.3.21
REFLECTION: 0.016479969024658 GETTER: 0.0015950202941895
Output for 5.3.20
REFLECTION: 0.017637968063354 GETTER: 0.0016038417816162
Output for 5.3.19
REFLECTION: 0.017806053161621 GETTER: 0.0020778179168701
Output for 5.3.18
REFLECTION: 0.01786994934082 GETTER: 0.0016078948974609
Output for 5.3.17
REFLECTION: 0.018234968185425 GETTER: 0.0015430450439453
Output for 5.3.16
REFLECTION: 0.018095970153809 GETTER: 0.0015130043029785
Output for 5.3.15
REFLECTION: 0.019541025161743 GETTER: 0.0014889240264893
Output for 5.3.14
REFLECTION: 0.017572164535522 GETTER: 0.0015718936920166
Output for 5.3.13
REFLECTION: 0.015484809875488 GETTER: 0.0017499923706055
Output for 5.3.12
REFLECTION: 0.015485048294067 GETTER: 0.0017461776733398
Output for 5.3.11
REFLECTION: 0.017060995101929 GETTER: 0.0017580986022949
Output for 5.3.10
REFLECTION: 0.017122030258179 GETTER: 0.0020041465759277
Output for 5.3.9
REFLECTION: 0.017956018447876 GETTER: 0.0015320777893066
Output for 5.3.8
REFLECTION: 0.016350030899048 GETTER: 0.0017538070678711
Output for 5.3.7
REFLECTION: 0.016515016555786 GETTER: 0.0015711784362793
Output for 5.3.6
REFLECTION: 0.017024040222168 GETTER: 0.0015478134155273
Output for 5.3.5
REFLECTION: 0.017927885055542 GETTER: 0.0019111633300781
Output for 5.3.4
REFLECTION: 0.017073154449463 GETTER: 0.0015649795532227
Output for 5.3.3
REFLECTION: 0.015986919403076 GETTER: 0.0015749931335449
Output for 5.3.2
REFLECTION: 0.017285108566284 GETTER: 0.0015790462493896
Output for 5.3.1
REFLECTION: 0.017003059387207 GETTER: 0.0021440982818604
Output for 5.3.0
REFLECTION: 0.014040946960449 GETTER: 0.0015490055084229
Output for 5.0.0 - 5.2.17
Fatal error: Call to undefined method ReflectionProperty::setAccessible() in /in/nALh7 on line 19
Process exited with code 255.
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/nALh7 on line 5
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/nALh7 on line 5
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/nALh7 on line 5
Process exited with code 255.