3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class WorkUnitDataType { const NoneType = 0; const ArrayType = 1; const JsonType = 2; const UrlType = 3; const FileType = 4; private $value; private $name; protected function __construct($input) { if (is_int($input)) { $this->setByValue($input); } else if (is_string($input)) { $this->setByName($input); } } protected function setByValue($value) { if (is_int($value)) { $this->value = $value; $this->name = WorkUnitDataType::toString($value); } } protected function setByName($name) { if (is_) $this->value = WorkUnitDataType::toString($name); $this->name = $name; } public static function toString($const) { $class = new ReflectionClass('WorkUnitDataType'); $constants = $class->getConstants(); foreach ($constants as $name => $value) { if ($value == $const) { return $name; } } return Null; } public static function toValue($text) { $class = new ReflectionClass('WorkUnitDataType'); $constants = $class->getConstants(); foreach ($constants as $name => $value) { if ($name == $text) { return $value; } } return -1; } } class NoneType extends WorkUnitDataType { public function __construct() { parent::__construct(get_class($this)); } } $a = new NoneType(); var_dump($a);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "is_" in /in/iLTUI:31 Stack trace: #0 /in/iLTUI(17): WorkUnitDataType->setByName('NoneType') #1 /in/iLTUI(65): WorkUnitDataType->__construct('NoneType') #2 /in/iLTUI(70): NoneType->__construct() #3 {main} thrown in /in/iLTUI on line 31
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:
48.35 ms | 401 KiB | 8 Q