3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Bar { } class Foo { private $bar; public function __construct(Bar $bar) { $this->bar = $bar; } } $reflect = new ReflectionClass('foo'); $constructor = $reflect->getConstructor(); $bar = new Bar; $t1 = microtime(true); for ($i = 0; $i < 10000; $i++) { $foo = new Foo($bar); } $t2 = microtime(true); echo 'new keyword: ' . ($t2-$t1) . '<br />'; $t1 = microtime(true); for ($i = 0; $i < 10000; $i++) { $foo = $reflect->newInstanceArgs([$bar]); } $t2 = microtime(true); echo 'newinstanceargs: ' . ($t2-$t1) . '<br />'; $t1 = microtime(true); for ($i = 0; $i < 10000; $i++) { $foo = $reflect->newInstanceWithoutConstructor(); $constructor->invokeArgs($foo, [$bar]); } $t2 = microtime(true); echo 'newinstancewithoutconstructor: ' . ($t2-$t1) . '<br />';
Output for 7.1.0
new keyword: 0.0017218589782715<br />newinstanceargs: 0.0038390159606934<br />newinstancewithoutconstructor: 0.0042428970336914<br />
Output for 7.0.14
new keyword: 0.0017008781433105<br />newinstanceargs: 0.0032799243927002<br />newinstancewithoutconstructor: 0.0042569637298584<br />
Output for 7.0.10
new keyword: 0.0013530254364014<br />newinstanceargs: 0.0026848316192627<br />newinstancewithoutconstructor: 0.002892017364502<br />
Output for 7.0.9
new keyword: 0.0013670921325684<br />newinstanceargs: 0.0027279853820801<br />newinstancewithoutconstructor: 0.0034010410308838<br />
Output for 7.0.8
new keyword: 0.0014970302581787<br />newinstanceargs: 0.0031840801239014<br />newinstancewithoutconstructor: 0.0036849975585938<br />
Output for 7.0.7
new keyword: 0.0012540817260742<br />newinstanceargs: 0.0028131008148193<br />newinstancewithoutconstructor: 0.003856897354126<br />
Output for 7.0.6
new keyword: 0.0011601448059082<br />newinstanceargs: 0.0027568340301514<br />newinstancewithoutconstructor: 0.0027620792388916<br />
Output for 7.0.5
new keyword: 0.0017309188842773<br />newinstanceargs: 0.0036370754241943<br />newinstancewithoutconstructor: 0.0042591094970703<br />
Output for 7.0.4
new keyword: 0.0014550685882568<br />newinstanceargs: 0.003061056137085<br />newinstancewithoutconstructor: 0.0035309791564941<br />
Output for 7.0.3
new keyword: 0.0018110275268555<br />newinstanceargs: 0.0034859180450439<br />newinstancewithoutconstructor: 0.0035240650177002<br />
Output for 7.0.2
new keyword: 0.0016839504241943<br />newinstanceargs: 0.0037288665771484<br />newinstancewithoutconstructor: 0.00388503074646<br />
Output for 7.0.1
new keyword: 0.0017650127410889<br />newinstanceargs: 0.003943920135498<br />newinstancewithoutconstructor: 0.0037870407104492<br />
Output for 7.0.0
new keyword: 0.0016920566558838<br />newinstanceargs: 0.00382399559021<br />newinstancewithoutconstructor: 0.004216194152832<br />
Output for hhvm-3.12.0
new keyword: 0.0027310848236084<br />newinstanceargs: 0.01264214515686<br />newinstancewithoutconstructor: 0.018968105316162<br />
Output for hhvm-3.10.0
new keyword: 0.0043210983276367<br />newinstanceargs: 0.030102968215942<br />newinstancewithoutconstructor: 0.042831897735596<br />
Output for 5.6.28
new keyword: 0.0045270919799805<br />newinstanceargs: 0.0082848072052002<br />newinstancewithoutconstructor: 0.0098640918731689<br />
Output for 5.6.25
new keyword: 0.0043761730194092<br />newinstanceargs: 0.0069410800933838<br />newinstancewithoutconstructor: 0.0075838565826416<br />
Output for 5.6.24
new keyword: 0.0033822059631348<br />newinstanceargs: 0.0061881542205811<br />newinstancewithoutconstructor: 0.0078630447387695<br />
Output for 5.6.23
new keyword: 0.0030770301818848<br />newinstanceargs: 0.0063169002532959<br />newinstancewithoutconstructor: 0.0063910484313965<br />
Output for 5.6.22
new keyword: 0.0024809837341309<br />newinstanceargs: 0.0052609443664551<br />newinstancewithoutconstructor: 0.0058319568634033<br />
Output for 5.6.21
new keyword: 0.0041642189025879<br />newinstanceargs: 0.0083019733428955<br />newinstancewithoutconstructor: 0.0092000961303711<br />
Output for 5.6.20
new keyword: 0.002795934677124<br />newinstanceargs: 0.0056238174438477<br />newinstancewithoutconstructor: 0.0065860748291016<br />
Output for 5.6.19
new keyword: 0.0028440952301025<br />newinstanceargs: 0.005748987197876<br />newinstancewithoutconstructor: 0.0065510272979736<br />
Output for 5.6.18
new keyword: 0.0042610168457031<br />newinstanceargs: 0.0082719326019287<br />newinstancewithoutconstructor: 0.0074079036712646<br />
Output for 5.6.17
new keyword: 0.0032238960266113<br />newinstanceargs: 0.0068120956420898<br />newinstancewithoutconstructor: 0.0070750713348389<br />
Output for 5.6.16
new keyword: 0.0026068687438965<br />newinstanceargs: 0.005465030670166<br />newinstancewithoutconstructor: 0.0059630870819092<br />
Output for 5.6.15
new keyword: 0.0035209655761719<br />newinstanceargs: 0.0070309638977051<br />newinstancewithoutconstructor: 0.0078420639038086<br />
Output for 5.6.14
new keyword: 0.0046920776367188<br />newinstanceargs: 0.0064787864685059<br />newinstancewithoutconstructor: 0.0076780319213867<br />
Output for 5.6.13
new keyword: 0.0030899047851562<br />newinstanceargs: 0.0061509609222412<br />newinstancewithoutconstructor: 0.0070259571075439<br />
Output for 5.6.12
new keyword: 0.0027680397033691<br />newinstanceargs: 0.0053548812866211<br />newinstancewithoutconstructor: 0.0060329437255859<br />
Output for 5.6.11
new keyword: 0.0035331249237061<br />newinstanceargs: 0.005810022354126<br />newinstancewithoutconstructor: 0.0067229270935059<br />
Output for 5.6.10
new keyword: 0.0041661262512207<br />newinstanceargs: 0.008091926574707<br />newinstancewithoutconstructor: 0.0092039108276367<br />
Output for 5.6.9
new keyword: 0.0037209987640381<br />newinstanceargs: 0.0071430206298828<br />newinstancewithoutconstructor: 0.008134126663208<br />
Output for 5.6.8
new keyword: 0.004162073135376<br />newinstanceargs: 0.0073299407958984<br />newinstancewithoutconstructor: 0.0083889961242676<br />
Output for 5.6.7
new keyword: 0.0040922164916992<br />newinstanceargs: 0.0078201293945312<br />newinstancewithoutconstructor: 0.0088570117950439<br />
Output for 5.6.6
new keyword: 0.0035369396209717<br />newinstanceargs: 0.0069940090179443<br />newinstancewithoutconstructor: 0.0083379745483398<br />
Output for 5.6.5
new keyword: 0.0042350292205811<br />newinstanceargs: 0.0087230205535889<br />newinstancewithoutconstructor: 0.0099380016326904<br />
Output for 5.6.4
new keyword: 0.0030498504638672<br />newinstanceargs: 0.0069749355316162<br />newinstancewithoutconstructor: 0.0075380802154541<br />
Output for 5.6.3
new keyword: 0.0044369697570801<br />newinstanceargs: 0.0084860324859619<br />newinstancewithoutconstructor: 0.0099430084228516<br />
Output for 5.6.2
new keyword: 0.0025730133056641<br />newinstanceargs: 0.005141019821167<br />newinstancewithoutconstructor: 0.0059459209442139<br />
Output for 5.6.1
new keyword: 0.0025501251220703<br />newinstanceargs: 0.0053169727325439<br />newinstancewithoutconstructor: 0.006030797958374<br />
Output for 5.6.0
new keyword: 0.0027840137481689<br />newinstanceargs: 0.0058290958404541<br />newinstancewithoutconstructor: 0.0061521530151367<br />
Output for 5.5.38
new keyword: 0.00307297706604<br />newinstanceargs: 0.0066230297088623<br />newinstancewithoutconstructor: 0.0081110000610352<br />
Output for 5.5.37
new keyword: 0.0036418437957764<br />newinstanceargs: 0.0073118209838867<br />newinstancewithoutconstructor: 0.0083310604095459<br />
Output for 5.5.36
new keyword: 0.004162073135376<br />newinstanceargs: 0.0081920623779297<br />newinstancewithoutconstructor: 0.0091731548309326<br />
Output for 5.5.35
new keyword: 0.0034451484680176<br />newinstanceargs: 0.0066790580749512<br />newinstancewithoutconstructor: 0.0072999000549316<br />
Output for 5.5.34
new keyword: 0.0032689571380615<br />newinstanceargs: 0.0063591003417969<br />newinstancewithoutconstructor: 0.0077910423278809<br />
Output for 5.5.33
new keyword: 0.0037729740142822<br />newinstanceargs: 0.0096840858459473<br />newinstancewithoutconstructor: 0.0065829753875732<br />
Output for 5.5.32
new keyword: 0.0026469230651855<br />newinstanceargs: 0.0052309036254883<br />newinstancewithoutconstructor: 0.0071480274200439<br />
Output for 5.5.31
new keyword: 0.0043230056762695<br />newinstanceargs: 0.011646032333374<br />newinstancewithoutconstructor: 0.012993812561035<br />
Output for 5.5.30
new keyword: 0.0037350654602051<br />newinstanceargs: 0.0074260234832764<br />newinstancewithoutconstructor: 0.0082769393920898<br />
Output for 5.5.29
new keyword: 0.0041689872741699<br />newinstanceargs: 0.0065381526947021<br />newinstancewithoutconstructor: 0.0077948570251465<br />
Output for 5.5.28
new keyword: 0.0039770603179932<br />newinstanceargs: 0.007673978805542<br />newinstancewithoutconstructor: 0.008681058883667<br />
Output for 5.5.27
new keyword: 0.0037450790405273<br />newinstanceargs: 0.0068111419677734<br />newinstancewithoutconstructor: 0.0079138278961182<br />
Output for 5.5.26
new keyword: 0.0036849975585938<br />newinstanceargs: 0.006911039352417<br />newinstancewithoutconstructor: 0.0080440044403076<br />
Output for 5.5.25
new keyword: 0.0037641525268555<br />newinstanceargs: 0.0066690444946289<br />newinstancewithoutconstructor: 0.0077238082885742<br />
Output for 5.5.24
new keyword: 0.0044031143188477<br />newinstanceargs: 0.0085880756378174<br />newinstancewithoutconstructor: 0.0092198848724365<br />
Output for 5.5.23
new keyword: 0.0026321411132812<br />newinstanceargs: 0.0052251815795898<br />newinstancewithoutconstructor: 0.0059700012207031<br />
Output for 5.5.22
new keyword: 0.0040152072906494<br />newinstanceargs: 0.0079300403594971<br />newinstancewithoutconstructor: 0.0069141387939453<br />
Output for 5.5.21
new keyword: 0.0041329860687256<br />newinstanceargs: 0.0083670616149902<br />newinstancewithoutconstructor: 0.0091888904571533<br />
Output for 5.5.20
new keyword: 0.0037350654602051<br />newinstanceargs: 0.007166862487793<br />newinstancewithoutconstructor: 0.0082788467407227<br />
Output for 5.5.19
new keyword: 0.0026581287384033<br />newinstanceargs: 0.0052080154418945<br />newinstancewithoutconstructor: 0.0059659481048584<br />
Output for 5.5.18
new keyword: 0.0043048858642578<br />newinstanceargs: 0.0089218616485596<br />newinstancewithoutconstructor: 0.0098838806152344<br />
Output for 5.5.16
new keyword: 0.0025880336761475<br />newinstanceargs: 0.0059578418731689<br />newinstancewithoutconstructor: 0.0066320896148682<br />
Output for 5.5.15
new keyword: 0.0039479732513428<br />newinstanceargs: 0.0075199604034424<br />newinstancewithoutconstructor: 0.0086538791656494<br />
Output for 5.5.14
new keyword: 0.0027720928192139<br />newinstanceargs: 0.0050768852233887<br />newinstancewithoutconstructor: 0.0058140754699707<br />
Output for 5.5.13
new keyword: 0.0037469863891602<br />newinstanceargs: 0.0070259571075439<br />newinstancewithoutconstructor: 0.008040189743042<br />
Output for 5.5.12
new keyword: 0.0024838447570801<br />newinstanceargs: 0.0054609775543213<br />newinstancewithoutconstructor: 0.0058348178863525<br />
Output for 5.5.11
new keyword: 0.0033469200134277<br />newinstanceargs: 0.0052280426025391<br />newinstancewithoutconstructor: 0.0064380168914795<br />
Output for 5.5.10
new keyword: 0.0034048557281494<br />newinstanceargs: 0.0065557956695557<br />newinstancewithoutconstructor: 0.0081892013549805<br />
Output for 5.5.9
new keyword: 0.0036258697509766<br />newinstanceargs: 0.0073349475860596<br />newinstancewithoutconstructor: 0.0082261562347412<br />
Output for 5.5.8
new keyword: 0.0033981800079346<br />newinstanceargs: 0.0054440498352051<br />newinstancewithoutconstructor: 0.0067410469055176<br />
Output for 5.5.7
new keyword: 0.004209041595459<br />newinstanceargs: 0.0082588195800781<br />newinstancewithoutconstructor: 0.0091898441314697<br />
Output for 5.5.6
new keyword: 0.002601146697998<br />newinstanceargs: 0.0050790309906006<br />newinstancewithoutconstructor: 0.0060667991638184<br />
Output for 5.5.5
new keyword: 0.0035748481750488<br />newinstanceargs: 0.0072441101074219<br />newinstancewithoutconstructor: 0.0081729888916016<br />
Output for 5.5.4
new keyword: 0.0043201446533203<br />newinstanceargs: 0.0080440044403076<br />newinstancewithoutconstructor: 0.007587194442749<br />
Output for 5.5.3
new keyword: 0.0042691230773926<br />newinstanceargs: 0.0079641342163086<br />newinstancewithoutconstructor: 0.0089938640594482<br />
Output for 5.5.2
new keyword: 0.0039098262786865<br />newinstanceargs: 0.0080118179321289<br />newinstancewithoutconstructor: 0.008836030960083<br />
Output for 5.5.1
new keyword: 0.0038299560546875<br />newinstanceargs: 0.0059499740600586<br />newinstancewithoutconstructor: 0.0067369937896729<br />
Output for 5.5.0
new keyword: 0.003587007522583<br />newinstanceargs: 0.0071489810943604<br />newinstancewithoutconstructor: 0.008167028427124<br />
Output for 5.4.45
new keyword: 0.0040898323059082<br />newinstanceargs: 0.0077459812164307<br />newinstancewithoutconstructor: 0.0087430477142334<br />
Output for 5.4.44
new keyword: 0.0040578842163086<br />newinstanceargs: 0.0073809623718262<br />newinstancewithoutconstructor: 0.0086369514465332<br />
Output for 5.4.43
new keyword: 0.0038740634918213<br />newinstanceargs: 0.0076768398284912<br />newinstancewithoutconstructor: 0.0090618133544922<br />
Output for 5.4.42
new keyword: 0.002734899520874<br />newinstanceargs: 0.0049920082092285<br />newinstancewithoutconstructor: 0.0057368278503418<br />
Output for 5.4.41
new keyword: 0.0034379959106445<br />newinstanceargs: 0.0067729949951172<br />newinstancewithoutconstructor: 0.0075681209564209<br />
Output for 5.4.40
new keyword: 0.002769947052002<br />newinstanceargs: 0.0051078796386719<br />newinstancewithoutconstructor: 0.0057740211486816<br />
Output for 5.4.39
new keyword: 0.0040030479431152<br />newinstanceargs: 0.007296085357666<br />newinstancewithoutconstructor: 0.006850004196167<br />
Output for 5.4.38
new keyword: 0.0031960010528564<br />newinstanceargs: 0.0060880184173584<br />newinstancewithoutconstructor: 0.008065938949585<br />
Output for 5.4.37
new keyword: 0.0040369033813477<br />newinstanceargs: 0.0068418979644775<br />newinstancewithoutconstructor: 0.008397102355957<br />
Output for 5.4.36
new keyword: 0.0025291442871094<br />newinstanceargs: 0.00514817237854<br />newinstancewithoutconstructor: 0.0058138370513916<br />
Output for 5.4.35
new keyword: 0.0043158531188965<br />newinstanceargs: 0.0071117877960205<br />newinstancewithoutconstructor: 0.0077569484710693<br />
Output for 5.4.34
new keyword: 0.0040609836578369<br />newinstanceargs: 0.0078458786010742<br />newinstancewithoutconstructor: 0.0085690021514893<br />
Output for 5.4.32
new keyword: 0.0032508373260498<br />newinstanceargs: 0.0059409141540527<br />newinstancewithoutconstructor: 0.0065979957580566<br />
Output for 5.4.31
new keyword: 0.0027298927307129<br />newinstanceargs: 0.0052530765533447<br />newinstancewithoutconstructor: 0.0059299468994141<br />
Output for 5.4.30
new keyword: 0.0039830207824707<br />newinstanceargs: 0.0077450275421143<br />newinstancewithoutconstructor: 0.0094680786132812<br />
Output for 5.4.29
new keyword: 0.0040731430053711<br />newinstanceargs: 0.0077841281890869<br />newinstancewithoutconstructor: 0.0086679458618164<br />
Output for 5.4.28
new keyword: 0.0044870376586914<br />newinstanceargs: 0.0083038806915283<br />newinstancewithoutconstructor: 0.0099480152130127<br />
Output for 5.4.27
new keyword: 0.00384521484375<br />newinstanceargs: 0.0073459148406982<br />newinstancewithoutconstructor: 0.0085971355438232<br />
Output for 5.4.26
new keyword: 0.0035691261291504<br />newinstanceargs: 0.0069310665130615<br />newinstancewithoutconstructor: 0.0077779293060303<br />
Output for 5.4.25
new keyword: 0.0038008689880371<br />newinstanceargs: 0.0073628425598145<br />newinstancewithoutconstructor: 0.0076589584350586<br />
Output for 5.4.24
new keyword: 0.0037441253662109<br />newinstanceargs: 0.0069949626922607<br />newinstancewithoutconstructor: 0.0079741477966309<br />
Output for 5.4.23
new keyword: 0.0041670799255371<br />newinstanceargs: 0.0063529014587402<br />newinstancewithoutconstructor: 0.0070428848266602<br />
Output for 5.4.22
new keyword: 0.0044031143188477<br />newinstanceargs: 0.0079891681671143<br />newinstancewithoutconstructor: 0.0086839199066162<br />
Output for 5.4.21
new keyword: 0.0046210289001465<br />newinstanceargs: 0.0082161426544189<br />newinstancewithoutconstructor: 0.0094568729400635<br />
Output for 5.4.20
new keyword: 0.0037808418273926<br />newinstanceargs: 0.0075368881225586<br />newinstancewithoutconstructor: 0.0083961486816406<br />
Output for 5.4.19
new keyword: 0.0034191608428955<br />newinstanceargs: 0.0065560340881348<br />newinstancewithoutconstructor: 0.007451057434082<br />
Output for 5.4.18
new keyword: 0.0043380260467529<br />newinstanceargs: 0.0083959102630615<br />newinstancewithoutconstructor: 0.009350061416626<br />
Output for 5.4.17
new keyword: 0.0045750141143799<br />newinstanceargs: 0.0083279609680176<br />newinstancewithoutconstructor: 0.0075728893280029<br />
Output for 5.4.16
new keyword: 0.0028269290924072<br />newinstanceargs: 0.0053160190582275<br />newinstancewithoutconstructor: 0.0064990520477295<br />
Output for 5.4.15
new keyword: 0.0043079853057861<br />newinstanceargs: 0.0081760883331299<br />newinstancewithoutconstructor: 0.0072500705718994<br />
Output for 5.4.14
new keyword: 0.0036540031433105<br />newinstanceargs: 0.0072031021118164<br />newinstancewithoutconstructor: 0.0085561275482178<br />
Output for 5.4.13
new keyword: 0.0045309066772461<br />newinstanceargs: 0.0085098743438721<br />newinstancewithoutconstructor: 0.0093460083007812<br />
Output for 5.4.12
new keyword: 0.0039970874786377<br />newinstanceargs: 0.0072448253631592<br />newinstancewithoutconstructor: 0.0089540481567383<br />
Output for 5.4.11
new keyword: 0.0040569305419922<br />newinstanceargs: 0.0077919960021973<br />newinstancewithoutconstructor: 0.0089859962463379<br />
Output for 5.4.10
new keyword: 0.0032188892364502<br />newinstanceargs: 0.0059678554534912<br />newinstancewithoutconstructor: 0.0058670043945312<br />
Output for 5.4.9
new keyword: 0.0036969184875488<br />newinstanceargs: 0.0058128833770752<br />newinstancewithoutconstructor: 0.006199836730957<br />
Output for 5.4.8
new keyword: 0.0032479763031006<br />newinstanceargs: 0.0053939819335938<br />newinstancewithoutconstructor: 0.0066511631011963<br />
Output for 5.4.7
new keyword: 0.0035419464111328<br />newinstanceargs: 0.0067138671875<br />newinstancewithoutconstructor: 0.0078179836273193<br />
Output for 5.4.6
new keyword: 0.0040638446807861<br />newinstanceargs: 0.0081989765167236<br />newinstancewithoutconstructor: 0.0090439319610596<br />
Output for 5.4.5
new keyword: 0.0033648014068604<br />newinstanceargs: 0.0066120624542236<br />newinstancewithoutconstructor: 0.0079488754272461<br />
Output for 5.4.4
new keyword: 0.0043919086456299<br />newinstanceargs: 0.0086679458618164<br />newinstancewithoutconstructor: 0.0093488693237305<br />
Output for 5.4.3
new keyword: 0.0040550231933594<br />newinstanceargs: 0.0076310634613037<br />newinstancewithoutconstructor: 0.0090270042419434<br />
Output for 5.4.2
new keyword: 0.0065348148345947<br />newinstanceargs: 0.010229110717773<br />newinstancewithoutconstructor: 0.0063760280609131<br />
Output for 5.4.1
new keyword: 0.003061056137085<br />newinstanceargs: 0.0058259963989258<br />newinstancewithoutconstructor: 0.010159969329834<br />
Output for 5.4.0
new keyword: 0.0038998126983643<br />newinstanceargs: 0.0062611103057861<br />newinstancewithoutconstructor: 0.007753849029541<br />
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/oXneA on line 33
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[', expecting ')' in /in/oXneA on line 33
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/oXneA on line 7
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/oXneA on line 7
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/oXneA on line 7
Process exited with code 255.