3v4l.org

run code in 300+ PHP versions simultaneously
<?php class STon { private static $instance; protected static $item; public static function get() { if (static::$instance === null) { static::$instance = static::$item; } return static::$instance; } } class A extends STon { protected static $item = "A"; } class B extends STon { protected static $item = "B"; } var_dump(A::get(), A::get(), B::get(), B::get(), A::get(), A::get(), B::get(), B::get());

preferences:
48.58 ms | 402 KiB | 5 Q