3v4l.org

run code in 300+ PHP versions simultaneously
<?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();
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?

preferences:
97.72 ms | 402 KiB | 85 Q