1
wizanda
Xoops Assigning a Variable by Reference
  • 2009/4/21 12:19

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Just to let you all know, that if you assign a variable by reference; it’s as stated a variable and not a function or class….
The reason being is from research found; it’s a reference point by variable….
So for example:
$tpl =& $xoopsTpl;

Will make the data in $xoopsTpl, change when anything in $tpl is changed….
$tpl =& new Funky($monkey);

How can it be referenced, if there is no variable associated with the transaction?
$tpl =& $handler->Funky($monkey);

This implies to use the $handler as a reference point… If you change $tpl how would it be sent into a function to change a variable, same within classes…..

2
ghia
Re: Xoops Assigning a Variable by Reference
  • 2009/4/21 19:55

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Your second assignment of $tpl destroys the object variable $xoopsTpl is still pointing to.
Do unset($tpl) before making a new assign.
I do not understand your third part of the post.

3
trabis
Re: Xoops Assigning a Variable by Reference
  • 2009/4/21 21:53

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


First argument is correct, I don't understand where you're going with the others. Maybe you could explain better or use other translator.

Login

Who's Online

438 user(s) are online (319 user(s) are browsing Support Forums)


Members: 0


Guests: 438


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits