Reply to Re: cannot re-assign $this ...

Your name:

Reply:


Posted by Rik on 02/21/07 14:55

Daniel Loose wrote:
> Henk Verhoeven wrote:
>
>> When you replace
>> $this =3D func_get_arg(0);
>> return;
>> by
>> return func_get_arg(0);
>>
>> you shoud get the same results in php4 and it should work in php5 too=
..
>>
>
> hm, thank you hank, however this is not the solution. of course it
> removes the cannot reassign error msg, but gives another errror in
> another line that wants to access the object (by using $this again)
> ("Call to a member function initLink() on a non-object ") I'm not an
> expert here but I don't think that return func... does the same as the=

> original code... :-)

Well, unfortunately, I have no solution for you. Then again, I'm not tha=
t =

well versed in OO, but this seems Bad Practise to me. A hidious, hidous,=
=

hidous quick fix could be, if the object is a global, to use this functi=
on =

instead:

function evil_switch_object($name,$object){
$GLOBALS[$name] =3D $object;
}

Then again, I can not find the logic to switch WHY this is not done like=
:

$foo =3D new foo();//first class/object
$bar =3D new bar();//second class/object
$foo =3D $bar;//instead of $foo->linkbar($bar);

Could you go into further detail as to why this exact construct is neede=
d? =

Seems illogical...
-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация