<?php
class A {
private $a = 'ahoj';
public function fet(&$a) {
}
public function __invoke(&$a) {
echo $this->a;
}
}
$a = new A;
/*$a('ahoj');
$ref = new \ReflectionMethod($a, '__invoke');
$ref->setAccessible(true);
$ref->invoke($a, 'ahoj');*/
function f_a(&$a) {
}
//f_a(2);
$ar = array($a, 'fet');
$ar('aa');
Fatal error: Uncaught Error: A::fet(): Argument #1 ($a) could not be passed by reference in /in/7CPGe:27
Stack trace:
#0 {main}
thrown in /in/7CPGe on line 27
Process exited with code 255.
Fatal error: Uncaught Error: A::fet(): Argument #1 ($a) cannot be passed by reference in /in/7CPGe:27
Stack trace:
#0 {main}
thrown in /in/7CPGe on line 27
Process exited with code 255.
Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in /in/7CPGe:27
Stack trace:
#0 {main}
thrown in /in/7CPGe on line 27
Process exited with code 255.
Fatal error: Function name must be a string in /in/7CPGe on line 27
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7CPGe on line 3
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7CPGe on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/7CPGe on line 3
Process exited with code 255.