webpractik-test-st - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of webpractik-test-st.php
- final class Product {
- private static $instance;
- public $a;
- public static function getInstance() {
- if (!(self::$instance instanceof self)) {
- self::$instance = new self();
- }
- return self::$instance;
- }
- private function __construct() {}
- private function __clone() {}
- private function __sleep() {}
- private function __wakeup() {}
- }
- $firstProduct = Product::getInstance();
- $secondProduct = Product::getInstance();
- $firstProduct->a = 1;
- $secondProduct->a = 2;