3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace My\Classes; Class MyClass { private static $myProperty = "test"; public static function getProp(){ return self::myProperty; } } namespace My\Classes; use My\Classes\MyClass; //The class above Class MyOtherClass { public static function getProperty(){ return MyClass::getProp(); //Returns Hello } } use My\Classes\MyOtherClass; echo MyOtherClass::getProperty();
based on AprdZ
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Undefined class constant 'myProperty' in /in/A1mSF:8 Stack trace: #0 /in/A1mSF(19): My\Classes\MyClass::getProp() #1 /in/A1mSF(26): My\Classes\MyOtherClass::getProperty() #2 {main} thrown in /in/A1mSF on line 8
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Undefined class constant 'myProperty' in /in/A1mSF on line 8
Process exited with code 255.