Class within a class

From: Date: Mon, 10 Feb 2003 19:36:22 +0000
Subject: Class within a class
Groups: php.general 
Request: Send a blank email to php-general+get-135109@lists.php.net to get a copy of this message
I have made a Mysql database class. I wanted to know how I could use that class in another class without using extend. For example: include 'db.php'; $db = new db(); ...some php code... class blah { var $test = 1; function blah() { ...... $db->query(some query); //mysql class being used here } } I don't want to create an instance of db class in the blah class because I use db in other parts of the script so an instance already exists. Any way I can do this?

« previous php.general (#135109) next »