3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyClass {} class OtherClass {} class SubClass extends MyClass {} $reflector = new ReflectionClass(MyClass::class); foreach( [ '$reflector->newLazyGhost(static fn() => null)', '$reflector->newLazyProxy(static fn() => null)', '$reflector->resetAsLazyGhost($m, static fn() => null)', '$reflector->resetAsLazyGhost($s, static fn() => null)', '$reflector->resetAsLazyGhost($o, static fn() => null)', '$reflector->resetAsLazyProxy($m, static fn() => null)', '$reflector->resetAsLazyProxy($s, static fn() => null)', '$reflector->resetAsLazyProxy($o, static fn() => null)', '$reflector->initializeLazyObject($o)', '$reflector->initializeLazyObject($o)', '$reflector->initializeLazyObject($o)', '$reflector->markLazyObjectAsInitialized($o)', '$reflector->markLazyObjectAsInitialized($o)', '$reflector->markLazyObjectAsInitialized($o)', '$reflector->getLazyInitializer($o)', '$reflector->getLazyInitializer($o)', '$reflector->getLazyInitializer($o)', '$reflector->isUninitializedLazyObject($o)', '$reflector->isUninitializedLazyObject($o)', '$reflector->isUninitializedLazyObject($o)', ] as $code ) { echo $code; try { $m = new MyClass(); $s = new SubClass(); $o = new OtherClass(); echo "\n RET: ". get_debug_type(eval("return $code;")); } catch(Throwable $e) { echo "\n ERR: ". get_class($e) . ': ' . $e->getMessage(); } echo "\n\n"; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.80.0110.00716.97
8.5.70.0060.00716.81
8.5.60.0030.00516.75
8.4.230.0150.00522.14
8.4.220.0050.00619.71
8.4.210.0040.00721.58
8.4.90.0020.00719.68
8.3.320.0050.00518.56
8.3.310.0070.00720.42
8.3.180.0040.00418.55
8.3.50.0130.00618.60
8.2.320.0100.00918.18
8.2.310.0030.00718.18

preferences:
40.95 ms | 578 KiB | 5 Q