Ben bir sınıf tanımı ile bir main.php dosyası var. Diğer php dosyaları bu main.php dosyayı kullanabilirsiniz
//main.php
<?php
class A{
}
//I want to execute the following statements exactly once
$a = new A();
/*
Some code
*/
?>
Ben gibi diğer php dosyalarında main.php kullanın
//php1.php
<?php
require_once("main.php");
$b = new A();
/*
Some code
*/
?>
//php2.php
<?php
require_once("main.php");
$b = new A();
/*
Some code
*/
?>
Is there any statement in PHP like execute_once()? How do I solve this?