3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // Call a static method on a string class or object returned by // an instance method call class foo { static function bar(){ static $flag = 1; $flag++; if ($flag == 2 ) { return 'blee'; } if ($flag == 3){ return new blee; } } } class blee { static function baz() { echo "Oh, for the baz of it!\n"; } } /**********************************/ $foo = new foo; echo $foo::bar()::baz();
based on EcGZn
Output for 7.0.0 - 7.2.0
Oh, for the baz of it!
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting ',' or ';' in /in/f38D5 on line 25
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/f38D5 on line 25
Process exited with code 255.