bir PHP komut dosyası aynı sınıfın örneğini önlemek için bir yol var?
$user = new User();
$user2 = new User(); // I want to catch another instance of the user class and throw an exception
Ben bir statik değişkeni oluşturma ve statik fonksiyonu ile manipüle denedim:
User::instance()
ama bunu yaparken beni durmuyor:
$user = new User();