I've db class which initiates link with the database and all sorts of the queries are tell you it.

Now i'm getting troubles with the truth that I'm not sure using it within other objects as well as using it within functions.

For instance if there's an item to process and display some data, then will i extend this resist the db class otherwise how do you obtain the connection for that $db within this class.

Also, how do you make use of the db connection inside a function outdoors a category. Will I publish the db class like a parameter or will i use GLOBAL $db

All of the "will iInch are really "must iInch, so please advice me what is the best for performance along with other benefits and drawbacks.

Usually frameworks give a singleton demonstration of the database connection, which may be acquired via static method (or global function) that returns the exemplified (static private) instance. This instance is produced once the first call for this technique is performed, for the following calls, it really returns it.