3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Hoge { private $val = 1; public function getVal() { return $this->val; } } trait MyTrait { public function cry() { echo "nya"; } } 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 "実体化可能? ", $h->isInstantiable() ? "true" : "false" , "\n"; } check("Hoge"); check("MyTrait");
based on YcF9Q
Output for 7.0.0 - 7.2.6
================ Hoge abstract? false trait? false interface? false 実体化可能? true ================ MyTrait abstract? false trait? true interface? false 実体化可能? false
Output for 5.4.10 - 5.6.28
================ Hoge abstract? false trait? false interface? false 実体化可能? true ================ MyTrait abstract? true trait? true interface? false 実体化可能? false
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/Aqi62 on line 12
Process exited with code 255.