Forum Moderators: coopster

Message Too Old, No Replies

Only variables should be assigned by reference

         

thing3b

11:10 am on Oct 12, 2005 (gmt 0)

10+ Year Member



I like to program in PHP with the errors as tight as possible. One of my newer errors or should I say "variation from standards" is...

Strict Standards: Only variables should be assigned by reference in C:\blah\blah\something.php on line 20

Now I understand that it is talking about the part of my code that looks like (note the &)...

$this->controls =& $this->commonEntityData->getControls();

My question is, how should I make sure that the variable passed back from a function is passed by reference and not value?

Thanks all.

jatar_k

3:00 pm on Oct 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



why do you need the ref there?

thing3b

8:05 pm on Oct 13, 2005 (gmt 0)

10+ Year Member



function &getControls() {
...
}

$foo =& getControls();

this rule should apply equally to object methods...
I was missing the & on &getControls() {