3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private privateMethod() { return 'caught'; } } $c = function() { return $this->privateMethod(); } $obj = new Test; $c = $c->bindTo($obj); $c();
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected 'privateMethod' (T_STRING), expecting variable (T_VARIABLE) in /in/NR0jP on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/NR0jP on line 4
Process exited with code 255.

preferences:
175.59 ms | 1386 KiB | 67 Q