<?php
class f
{
function f(&$e){ var_dump($e); }
}
function getNew($c, $a)
{
$r = new ReflectionClass($c);
return $r->newInstanceArgs($a);
}
$e = new stdClass;
var_dump(getNew('f', array(&$e)));
Fatal error: Uncaught ReflectionException: Class f does not have a constructor, so you cannot pass any constructor arguments in /in/Emraa:11
Stack trace:
#0 /in/Emraa(11): ReflectionClass->newInstanceArgs(Array)
#1 /in/Emraa(16): getNew('f', Array)
#2 {main}
thrown in /in/Emraa on line 11
Process exited with code 255.
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; f has a deprecated constructor in /in/Emraa on line 3
object(stdClass)#1 (0) {
}
object(f)#3 (0) {
}