Is it possible to pass a database object(or any object for that matter) as an argument to a function inside of a class? So, for example, will this work, and if not, how can I do something like this:
class Test
{
var $db;
function Test($db)
{
$this->db = $db;
}
function Query($sql)
{
$result = $this->db->Execute($sql);
// ...
}
}
$db = new DB();
$test = new Test($db);
$test->Query("SELECT * FROM user");