Using a object in methods of other objects
问题 in this case I create a sqlite3 object in the main file of my script: $db = new sqlite3('file.sqlite'); now I need to access the sqlite file in different other methods of other classes. But what is the best way to access the object there? Create every time a new object? Use in the methode global? global $db; Or deliver it as argument? $object = new exampleClass($db); 回答1: Definitely: $object = new exampleClass($db); Or it is possible to use a registry class to store objects and then retrieve