3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Call a static method on a string class or object returned by // an instance method call $foo->bar()::baz(); class bla { 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 bla; echo $foo::bar()::$baz();
Output for 7.0.0 - 7.0.1
Parse error: syntax error, unexpected '$baz' (T_VARIABLE) in /in/SF4ZQ on line 23
Process exited with code 255.
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) in /in/SF4ZQ on line 4
Process exited with code 255.

preferences:
163.06 ms | 1399 KiB | 25 Q