3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private static function __invke() { echo "a"; }};//function() {}; $a = new A; //$a = function() { echo "b";}; $ref = new ReflectionMethod($a, '__invoke'); var_dump(is_object($a), is_callable($a)); $a(); $ref->setAccessible(true); $b = 3; $ref->invoke($a, &$b); exit; function a($a) { } $b = 3; a($b);
Output for 5.4.18 - 5.4.19
Fatal error: Call-time pass-by-reference has been removed in /in/lZk5S on line 10
Process exited with code 255.
Output for 5.4.0 - 5.4.17
Fatal error: Call-time pass-by-reference has been removed in /in/U9SBf on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Deprecated: Call-time pass-by-reference has been deprecated in /in/U9SBf on line 10 Fatal error: Uncaught exception 'ReflectionException' with message 'Method A::__invoke() does not exist' in /in/U9SBf:5 Stack trace: #0 /in/U9SBf(5): ReflectionMethod->__construct(Object(A), '__invoke') #1 {main} thrown in /in/U9SBf on line 5
Process exited with code 255.

preferences:
195.39 ms | 1395 KiB | 55 Q