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 { public const A = 22; private const EQUALS = ['=']; private $symbol; private function __const(string $symbol) { $this->symbol = $symbol; } } $a = "A"; var_dump(Operator::$a) var_dump(Enum::EQUALS());
Output for 7.1.0 - 7.1.7
Parse error: syntax error, unexpected 'var_dump' (T_STRING) in /in/iK81l on line 27
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /in/iK81l on line 17
Process exited with code 255.

preferences:
169.42 ms | 1395 KiB | 36 Q