3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class MyClass { private $val = 1; public function getVal() { return $this->val; } } trait MyTrait { public function cry() { echo "nya"; } } interface MyInterface { public function say(); } abstract class MyAbstract { abstract public function shout(); } function check($class_name) { echo "================ ", $class_name, " ================= \n"; $h = new \ReflectionClass($class_name); echo "abstract? ", $h->isAbstract() ? "true" : "false" , "\n"; echo "trait? ", $h->isTrait() ? "true" : "false" , "\n"; echo "interface? ", $h->isInterface() ? "true" : "false" , "\n"; echo "instantiable? ", $h->isInstantiable() ? "true" : "false" , "\n"; } check("MyClass"); check("MyTrait"); check("MyInterface"); check("MyAbstract");
based on HP5Vb
Output for 7.0.0 - 7.3.0rc4
================ MyClass ================= abstract? false trait? false interface? false instantiable? true ================ MyTrait ================= abstract? false trait? true interface? false instantiable? false ================ MyInterface ================= abstract? true trait? false interface? true instantiable? false ================ MyAbstract ================= abstract? true trait? false interface? false instantiable? false
Output for 5.4.10 - 5.6.28
================ MyClass ================= abstract? false trait? false interface? false instantiable? true ================ MyTrait ================= abstract? true trait? true interface? false instantiable? false ================ MyInterface ================= abstract? true trait? false interface? true instantiable? false ================ MyAbstract ================= abstract? true trait? false interface? false instantiable? false
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/cclmI on line 12
Process exited with code 255.