Error: Only variables should be assigned by reference

I have a function that searches for and returns an object, but if the object isn’t found it returns FALSE (NULL gives same error btw).

The problem is that I want that object returned as a reference. However, if the object isn’t found and the return is FALSE or NULL it’s not allowed to pass it as refence. What to do?

Not exact php, just some short pseudo-example:
[php]
function getObject($findthis)
{
if ($findthis === TRUE) {
return $object;
} else {
return FALSE;
}
}

$obj =& getObject(“myobject”);
[/php]

Actually, I don’t know why the error occurs. It doesn’t only occur if I reply FALSE, it occurs all the time. Even if the replied value is an object.

Sponsor our Newsletter | Privacy Policy | Terms of Service