<?php
class Papa {
public function __construct() {
$args = func_get_args();
echo print_r($args, true);
}
}
class Kiddo extends Papa {
public function __construct() {
$args = func_get_args();
$parent_class = 'parent';
if (version_compare(PHP_VERSION, '5.5.0') >= 0) {
$parent_class = parent::class;
}
call_user_func_array(array($parent_class, '__construct'), $args);
}
}
$x = new Papa('bee');
$y = new Kiddo('hello', 'me');
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/E9eTR on line 15
Process exited with code 255.