<?php class SingletonTest { protected static $_instance; private function __construct(){} private function __clone(){} public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } return self::$_instance; } } class PrivacyViolator { private $_caller; function __construct() { $this->_caller = function ($method, $args) { return call_user_func_array([$this, $method], $args); }; } function callPrivateMethod($object, $method, $args) { $this->_caller->bindTo($object, $object); return $this->_caller($method, $args); } } $myObject = SingletonTest::getInstance(); $privacyViolator = new PrivacyViolator(); $newObject = $privacyViolator->callPrivateMethod($myObject, '__construct', []);
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`