3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class bla { static function bar(){ static $flag = 0; $flag++; if ($flag == 1 ) { echo 'string name blee',"\n"; return 'blee'; } if ($flag == 2){ echo 'new object blee',"\n"; return new blee; } } } class blee { static $baz = "Oh, baz!\n"; } /**********************************/ $foo = "bla"; echo $foo::bar()::$baz; $foo = new bla; echo $foo::bar()::$baz;
based on n895P
Output for 7.0.0 - 7.3.0alpha1
string name blee Oh, baz! new object blee Oh, baz!
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting ',' or ';' in /in/t71Td on line 24
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in /in/t71Td on line 24
Process exited with code 255.