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 other other methods of other classes. But what is the best way to access this object?
Create a new object each time?
Use global in the method?
global $db;
Or deliver it as an argument?
$object = new exampleClass($db);
source
share