- print_r: documentation ( source)
<?php
class foo {
public static function who(){
return __CLASS__;
}
static public function create($params = array()){
$class = static::who();
return new $class($params);
}
}
class bar extends foo {}
print_r(foo::create());
print_r(bar::create());