Hi
I'm new to PHP and want some help understanding something. My problem involves PEAR.
I've create a class called mypear which extends pear. I've done this for the automatic destructor stuff. Anyway it all works OK except that I don't understand if I should be creating my pear object using = or &=.
Looking at PEAR:😃B that returns a DB_Common object which inherits PEAR. This creates the object DB_common or DB_Error and returns a reference to it.
However all of the examples involving DB, state that you should do the following.
$conn = DB::Connect(...) etc.
This is where I get a bit lost. The fact that the connect function has returned a reference matters not here as I've not used &= to assign $conn. Hence I would expect my object to be a copy which will not have its _PEAR method called after script execution ends. This is because the constructor has passed a reference to $this which now doesn't exist. Granted I understand that if I had used &= that my object would be a true reference.
Can someone explain if I talking rubbish or is this correct and the docs should have said use &=. I guess I'm not sure if a reference can be returned to the caller without the caller realising it.
Thanks in advance.
Darren