3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class a { static function b() { static $c; if(!$c) { $c = get_class(self); } echo $c; } } class b extends a{} class c extends a{} b::b(); c::b();
based on IeZEi
Output for 7.2.0
Warning: Use of undefined constant self - assumed 'self' (this will throw an Error in a future version of PHP) in /in/VEsLH on line 10 Warning: get_class() expects parameter 1 to be object, string given in /in/VEsLH on line 10 Warning: Use of undefined constant self - assumed 'self' (this will throw an Error in a future version of PHP) in /in/VEsLH on line 10 Warning: get_class() expects parameter 1 to be object, string given in /in/VEsLH on line 10
Output for 5.3.22 - 7.1.10
Notice: Use of undefined constant self - assumed 'self' in /in/VEsLH on line 10 Warning: get_class() expects parameter 1 to be object, string given in /in/VEsLH on line 10 Notice: Use of undefined constant self - assumed 'self' in /in/VEsLH on line 10 Warning: get_class() expects parameter 1 to be object, string given in /in/VEsLH on line 10