function db_get_something( $x ) {
static $cache = array();
if(empty($cache[$x])) {
$cache[$x] = //some db query result;
}
return $cache[$x];
}class db_get_somethning {
private $cache = array();
function func() {
if(empty($this->cache[$x]))
this->cache[$x] = //some db query result;
return $this->cache[$x];
}
}