Richard Heyes schreef: >>> I always store database handler in $GLOBALS. >>> I think that's the best place to save request-level-global. >>> I wonder where other people save that kind of data. >> >> how about a static variable inside a function or a static member of a >> class. >> >> e.g. >> >> function getDB($args) { >> static $conn = array(); >> >> $key = serialize($args); >> if (!isset($conn[ $key ]) >> $conn[ $key ] = new DBConn($args); >> >> return $conn[ $key ]; >> } > > That's surprisingly similar to how I do it. Then it's a simple matter to > call getDB() (which you can do no matter what the current scope is) to > get the database object. guess we agree on somethings :-) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php