3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php final class MyType { const UNKNOWN = 0; const VALUE_ONE = 1; const VALUE_TWO = 2; const VALUE_THREE = 3; const VALUE_FOUR = 4; const VALUE_FIVE = 5; static public $__names = array( 0 => 'UNKNOWN', 1 => 'VALUE_ONE', 2 => 'VALUE_TWO', 3 => 'VALUE_THREE', 4 => 'VALUE_FOUR', 5 => 'VALUE_FIVE', ); } $test = new MyType(); echo constant($test.$test->__names[count($test->__names) - 1]); ?>
Output for 7.1.0
Notice: Accessing static property MyType::$__names as non static in /in/DEfEn on line 22 Notice: Undefined property: MyType::$__names in /in/DEfEn on line 22 Notice: Accessing static property MyType::$__names as non static in /in/DEfEn on line 22 Notice: Undefined property: MyType::$__names in /in/DEfEn on line 22 Recoverable fatal error: Object of class MyType could not be converted to string in /in/DEfEn on line 22
Process exited with code 255.
Output for 7.0.0 - 7.0.14
Notice: Accessing static property MyType::$__names as non static in /in/DEfEn on line 22 Notice: Undefined property: MyType::$__names in /in/DEfEn on line 22 Notice: Accessing static property MyType::$__names as non static in /in/DEfEn on line 22 Notice: Undefined property: MyType::$__names in /in/DEfEn on line 22 Catchable fatal error: Object of class MyType could not be converted to string in /in/DEfEn on line 22
Process exited with code 255.
Output for hhvm-3.12.0
Notice: Undefined property: MyType::$__names in /in/DEfEn on line 22 Notice: Undefined property: MyType::$__names in /in/DEfEn on line 22 Catchable fatal error: Object of class MyType could not be converted to string in /in/DEfEn on line 22
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.3.6 - 5.6.28
Strict Standards: Accessing static property MyType::$__names as non static in /in/DEfEn on line 22 Notice: Undefined property: MyType::$__names in /in/DEfEn on line 22 Strict Standards: Accessing static property MyType::$__names as non static in /in/DEfEn on line 22 Notice: Undefined property: MyType::$__names in /in/DEfEn on line 22 Catchable fatal error: Object of class MyType could not be converted to string in /in/DEfEn on line 22
Process exited with code 255.