I've got a PHP function (call it funcA) that is used in multiple places, so I placed funcA (and some related functions) in a separate file that is require
d in other PHP files. funcA makes numerous queries on a database that is already open and used by the code that calls it. Those queries are done via an MDB2 object.
As it stands now, where funcA is called, the calling routine passes an already-connected MDB2 object pointer to it. This works fine.
What I'm wondering is if it would be better to make funcA completely self-contained by not passing the MDB2object pointer and instead having funcA require
MDB2 and connect to the database with its own mdb2 object. It's more memory, more CPU cycles, and more network traffic, but is it a better practice?