3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classNames = array("StdClass", "ArrayObject", "SplFileObject"); foreach($classNames as $className) { var_dump(instanitateWithoutConstructorThroughUnserialize($className)); var_dump(instanitateWithoutConstructorThroughReflection($className)); } function instanitateWithoutConstructorThroughUnserialize($className) { return unserialize(sprintf('O:%d:"%s":0:{}', strlen($className), $className)); } function instanitateWithoutConstructorThroughReflection($className) { try { $ref = new ReflectionClass($className); $inst = $ref->newInstanceWithoutConstructor(); } catch (ReflectionException $e) { return $e; } }
Output for git.master, git.master_jit, rfc.property-hooks
object(stdClass)#1 (0) { } NULL Fatal error: Uncaught UnexpectedValueException: Incomplete or ill-typed serialization data in /in/91fZf:10 Stack trace: #0 [internal function]: ArrayObject->__unserialize(Array) #1 /in/91fZf(10): unserialize('O:11:"ArrayObje...') #2 /in/91fZf(5): instanitateWithoutConstructorThroughUnserialize('ArrayObject') #3 {main} thrown in /in/91fZf on line 10
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
39.69 ms | 401 KiB | 8 Q