3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types = 1); abstract class Object {} interface iObjectID { public function getId(); public function setId(int $id = NULL); } trait tObjectID { /** * @TF: {column => id, type => int} * integer $id */ protected $id; public function getId() { return $this->id; } public function setId(int $id = NULL) { $this->id = $id; } } trait tObjectName { /** * @TF: {column => name, type => string} * string $name */ protected $name; public function getName(): string { return $this->name; } public function setName(string $name = NULL) { $this->name = $name; } } trait tObjectCoolurl { /** * @TF: {column => coolurl, type => string} * string $coolurl */ protected $coolurl; public function getCoolurl(): string { return $this->coolurl; } public function setCoolurl(string $coolurl = NULL) { $this->coolurl = $coolurl; } } class Gallery extends Object implements iObjectID { use tObjectID; use tObjectName; use tObjectCoolurl; } //Instantiate the reflection object $reflector = new ReflectionClass('Gallery'); // Now get all the properties from class A in to $properties array $properties = $reflector->getProperties(); var_dump($properties);
Output for 7.2.0
Fatal error: Cannot use 'Object' as class name as it is reserved in /in/AWRtc on line 4
Process exited with code 255.
Output for 7.0.0 - 7.1.10
array(3) { [0]=> object(ReflectionProperty)#2 (2) { ["name"]=> string(2) "id" ["class"]=> string(7) "Gallery" } [1]=> object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "name" ["class"]=> string(7) "Gallery" } [2]=> object(ReflectionProperty)#4 (2) { ["name"]=> string(7) "coolurl" ["class"]=> string(7) "Gallery" } }
Output for 5.4.10 - 5.6.21
Warning: Unsupported declare 'strict_types' in /in/AWRtc on line 2 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/AWRtc on line 43
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Warning: Unsupported declare 'strict_types' in /in/AWRtc on line 2 Parse error: syntax error, unexpected T_STRING in /in/AWRtc on line 14
Process exited with code 255.