- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.26
- Parse error: syntax error, unexpected '{', expecting '(' in /in/Kv3or on line 31
Process exited with code 255.
<?php
class Singleton
{
private function __construct(){}
private function __clone(){}
private function __sleep(){}
private function __wakeup(){}
private static $instance;
public static function getInstance()
{
if ( ! self::$instance)
{
self::$instance = new static();
}
return self::$instance;
}
}
$obj1 = Singleton::getInstance();
$obj2 = Singleton::getInstance();
var_dump(spl_object_hash($obj1) == spl_object_hash($obj2));
$cloner = function(){
return function{}(
return clone $this;
);
};
$obj3 = null;
$obj3 = $cloner->bindTo($obj1)->__invoke();
var_dump(spl_object_hash($obj1) == spl_object_hash($obj3));