<?php class Foo { protected function __construct() {} public static function create($name) { class_alias(get_called_class(), $name); return new $name(); } } $bar = Foo::create('Bar');
You have javascript disabled. You will not be able to edit any code.