3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class AnonymousClassImporter { static public function __set_state($data){ return new class($data){ public function __construct($data){ foreach($data as $key => $value){ $this->{$key} = $value; } } }; } } spl_autoload_register(function($name){ if(str_starts_with($name, "class@anonymous\0")){ class_alias('AnonymousClassImporter', $name); } }, prepend: true); $imported = ('class@anonymous' . "\0" . '/in/RXBTu:3$0')::__set_state(array( 'x' => 12, )); var_dump($imported);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property class@anonymous::$x is deprecated in /in/2HgDQ on line 8 object(class@anonymous)#2 (1) { ["x"]=> int(12) }

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:
37.46 ms | 405 KiB | 5 Q