<?php
class myclass
{
public function say_hello()
{
echo "Hello!";
}
public function my_word()
{
call_user_func(array($c, "say_hello"));
}
}
$c = new myclass();
$c->my_word();
Warning: Undefined variable $c in /in/pKqoY on line 11
Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object in /in/pKqoY:11
Stack trace:
#0 /in/pKqoY(17): myclass->my_word()
#1 {main}
thrown in /in/pKqoY on line 11
Process exited with code 255.
Output for 8.0.0 - 8.0.9
Warning: Undefined variable $c in /in/pKqoY on line 11
Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($function) must be a valid callback, first array member is not a valid class name or object in /in/pKqoY:11
Stack trace:
#0 /in/pKqoY(17): myclass->my_word()
#1 {main}
thrown in /in/pKqoY on line 11
Process exited with code 255.
Notice: Undefined variable: c in /in/pKqoY on line 11
Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in /in/pKqoY on line 11
Output for 7.3.32 - 7.3.33
Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in /in/pKqoY on line 11
Notice: Undefined variable: c in /in/pKqoY on line 11
Warning: call_user_func(Array): First argument is expected to be a valid callback in /in/pKqoY on line 11
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: c in /in/pKqoY on line 11
Warning: call_user_func(Array): First argument is expected to be a valid callback in /in/pKqoY on line 11
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/pKqoY on line 4
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/pKqoY on line 4
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/pKqoY on line 4
Process exited with code 255.