Let's suppose I have a class that encompasses a function such as this:
class SomeClass
{
var $db_resource;
function &db_connect()
{
$this->db_resource =& database_connect($host, $user,$pass, $dbname);
return $this->db_resource;
}
}
And then I create a new instance like this:
$instance = new SomeClass;
$my_connection =& $instance->db_connect();
My two questions are:
1) Is $my_connection the exact same resource as $this->db_resource? Or am I just making copies of resources? Or is $my_connection a reference to a reference ($this->db_resource).
2) Is it more efficient to use references in this way, rather than make copies?
I understand C++ pointers and such, but as I have read, PHP's references aren't exactly like that.