3v4l.org

run code in 300+ PHP versions simultaneously
<?php class RootClass { public static function getStaticName() { echo 'get_called_class(): ' . get_called_class(). "\n"; echo 'static::$class: ' . static::$class . "\n"; } public function getName() { static::getStaticName(); } } class SubClass extends RootClass {} $instance = new SubClass(); $instance->getName();
Output for git.master, git.master_jit, rfc.property-hooks
get_called_class(): SubClass Fatal error: Uncaught Error: Access to undeclared static property SubClass::$class in /in/AHYjG:6 Stack trace: #0 /in/AHYjG(9): RootClass::getStaticName() #1 /in/AHYjG(16): RootClass->getName() #2 {main} thrown in /in/AHYjG on line 6
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:
58 ms | 401 KiB | 8 Q