3v4l.org

run code in 300+ PHP versions simultaneously
<?php class EmptyObj{ protected function __construct(){} public static function get(){ static $obj; if(!$obj) $obj = new EmptyObj; return $obj; } public function __call($n, $a){ return $this; } public __toString(){ return ''; } } class SomeClass{ public $image; public function __construct(){ $this->image = EmptyObj::get(); }} $a = new SomeClass; echo $a->image->oopsForgotToSetImage();
Output for 5.4.13
Parse error: syntax error, unexpected '__toString' (T_STRING), expecting variable (T_VARIABLE) in /in/4rYiR on line 13
Process exited with code 255.
Output for 5.4.0 - 5.4.12
Parse error: syntax error, unexpected '__toString' (T_STRING), expecting variable (T_VARIABLE) in Y7bTn on line 13
Process exited with code 255.
Output for 5.3.23
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/4rYiR on line 13
Process exited with code 255.
Output for 5.3.0 - 5.3.22
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in Y7bTn on line 13
Process exited with code 255.

preferences:
172.6 ms | 1395 KiB | 45 Q