with the follow code:
<?php
class Loader {
private static $instances;
function __construct($class = null) {
return self::instance($class);
}
public static function instance($class) {
if(!isset(self::$instances[$class])) {
self::$instances[$class] = new $class();
}
return self::$instances[$class];
}
}
class Core {
}
$core = new Loader('Core');
print_r($core);
?>
my print_r() return the object Loader instead the object Core, which is instantiated after Loader is constructed.
Thanks for help!