3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Enum { private static $cache = []; public static function __callStatic($name, $params) { $className = get_called_class(); if(!isset(self::$cache[$name])) { self::$cache[$name] = new $className($className::$$name); } return self::$cache[$name]; } } class Operator { private const EQUALS = ['=']; private $symbol; private function __const(string $symbol) { $this->symbol = $symbol; } } var_dump(Enum::EQUALS());
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Access to undeclared static property Enum::$EQUALS in /in/KKkL6:10 Stack trace: #0 /in/KKkL6(24): Enum::__callStatic('EQUALS', Array) #1 {main} thrown in /in/KKkL6 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:
54.35 ms | 401 KiB | 8 Q