3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo\Singleton; class Singleton { /** * The single instance */ private static $instance; /** * Prevent object creation */ private function __construct() {} private function __clone() {} /** * Get Singleton instance */ public static function getInstance() { if(is_null(self::instance)) { self::instance = new Singleton; } return self::instance; } } $singleton = Singleton::getInstance();
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.24
Parse error: syntax error, unexpected '=' in /in/9aXne on line 24
Process exited with code 255.

preferences:
181.11 ms | 1395 KiB | 61 Q