|
Posted by gosha bine on 07/19/07 12:07
On 19.07.2007 13:54 Mortimer wrote:
> Scriveva gosha bine giovedì, 19/07/2007:
>> On 19.07.2007 12:26 Mortimer wrote:
>>>> I've noticed in your first example you didn't assign anything to
>>>> MySecondClass->$obj, perhaps that is the problem ;)
>>>
>>> Sorry, i didn't write it, but i assign the object in the constructor,
>>> like this:
>>>
>>> class Session {
>>> private $db;
>>> function __construct($db) {
>>> $this->db = $db;
>>> }
>>> function __destruct() {
>>> echo "Destroyed Session\n";
>>> }}
>>>
>>> Uhm.. thank you
>>>
>>>
>>
>> I'm lost now. :-o
>>
>> What does this print for you?
>>
>>
>> class Database {
>> function __destruct() {
>> echo "Destroyed Database\n";
>> }}
>> class Session {
>> private $db;
>> function __construct($db) {
>> $this->db = $db;
>> }
>> function __destruct() {
>> echo "Destroyed Session\n";
>> }}
>> $db = new Database;
>> $sess = new Session($db);
>> die();
>
> This prints
> Destroyed Database
> Destroyed Session
>
> :\
>
>
Definitely a bug. I would upgrade to php 5.2.
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Navigation:
[Reply to this message]
|