<?php
class A {
public function __construct() {
var_dump(func_get_args());
}
}
class B extends A {
function __construct() {
// call the parent constructor with whatever parameters were provided
call_user_func_array(array('parent', '__construct'), func_get_args());
// Additional actions that do not need direct access to the parameters
echo __CLASS__;
}
}
new B(1,2,3);
Fatal error: func_get_args(): Can't be used as a function parameter in /in/AjCMb on line 11
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/AjCMb 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/AjCMb 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/AjCMb on line 3
Process exited with code 255.