On 8 December 2010 01:12, Tom Robinson <tom.robin...@motec.com.au> wrote:
> Thanks David.
>
> If my understanding is correct, then:
>
> SPControlPanel::getContentTypes($db);
>
> is a reference to a static instantiation of the class. If so, then it
> must be syntactically something like when using 'new' (which returns a
> reference) so there's no need to apply the & operator. Am I on the right
> track?
>
> I have some more PHP4 code in the application which caused: "PHP
> Notice:  Only variable references should be returned by reference". I
> have fixed it like this:
>
> <       function & _getTable($cached=true)
> <       {
> <               return new TableClass($this->_getTableName());
> ---
>>       function & _getTable($cached=true) {
>>               $temp = new TableClass($this->_getTableName());
>>               return $temp;
>
> Is this acceptable?
>
> I'll have to come back to the $db issue - it's not issuing a warning so
> I'll leave it alone until I've tidied up all the other issues.
>
> Regards,
>
> Tom

I'd go with ...

function _getTable($cached=true) {
  return new TableClass($this->_getTableName());
}



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to