<?php
trait Singleton
{
protected static $instance;
final public static function getInstance()
{
if (!isset(static::$instance)) {
static::$instance = new static;
}
return static::$instance;
}
}
abstract class Abudabia {
use Singleton;
}
abstract class Mozambik {
use Singleton;
}
class a1 extends Abudabia
{
public function set()
{
return 'allah ahbar';
}
}
class a2 extends Mozamkbik
{
public function get()
{
return 'algazira';
}
}
$a = a1::getInstance();
$b = a2::getInstance();
var_dump($a->set(),$b->get());
Fatal error: Uncaught Error: Class "Mozamkbik" not found in /in/jiNB6:31
Stack trace:
#0 {main}
thrown in /in/jiNB6 on line 31
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Class 'Mozamkbik' not found in /in/jiNB6:31
Stack trace:
#0 {main}
thrown in /in/jiNB6 on line 31
Process exited with code 255.