3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait TraitWithProperties { private $a = 'foo'; protected $b = 'bar'; public $c = 'baz'; private static $as = self::class; protected static $bs = __TRAIT__; public static $cs = __CLASS__; } class SimpleClassWithTrait { use TraitWithProperties; } $refClass = new ReflectionClass('SimpleClassWithTrait'); var_dump($refClass->getStaticProperties());
based on aDdQ6
Output for 5.6.17 - 5.6.28, 7.0.1 - 7.2.0
array(3) { ["as"]=> string(20) "SimpleClassWithTrait" ["bs"]=> string(19) "TraitWithProperties" ["cs"]=> string(20) "SimpleClassWithTrait" }
Output for 7.0.0
array(3) { ["as"]=> string(19) "TraitWithProperties" ["bs"]=> string(19) "TraitWithProperties" ["cs"]=> string(20) "SimpleClassWithTrait" }
Output for 5.5.24 - 5.6.16
Fatal error: Invalid binding type in /in/0n4mP on line 12
Process exited with code 139.
Output for 5.4.9 - 5.4.45
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) in /in/0n4mP on line 9
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/0n4mP on line 3
Process exited with code 255.