Is it possible to use an object within an object? For example, I have a MySQL class which has every MySQL related method (connect, query, get rows…), and I’m making a new object called User, which will have methods such as login, logout, register etc… Is it possible to include my MySQL class, define an object and then run queries in my new object? If so, HOW?
For example:
class User{
$m = new MySQL();
function login($username, $password, $remember = false){
$m->rQuery("SELECT * FROM users......");
}
}
Yes, you can use it like this: