- Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- Does it work?
<?php
class MySingleton {
private static MySingleton $instance;
public static function getInstance () {
return self::$instance ??= new MySingleton();
}
private function __construct () {
echo "Does it work?";
}
}
$instance = MySingleton::getInstance();