Re: loading classes and efficiency
| From: | Mike Migurski | Date: | Thu, 11 Sep 2003 02:12:14 +0000 |
| Subject: | Re: loading classes and efficiency | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162241@lists.php.net to get a copy of this message | ||
>>>This is really funny i've been doing php for a good while now but what
>>>is the reason to use the & symbol on the function ?
>>
>>returns by reference.
>
>ok i get it but why would i need it in my example ?
I think it was a hypothetical thing on Brad's part ... one of the annoying
things about object creation is that there are several steps in the chain
where references become copies: 'new', the return from the constructor
function, and the '=' operator itself. So if you really want to use true
references everywhere (which you probably don't; they don't save much
memory/CPU), you end up having to pepper your code with ampersands
/everywhere/. Then the joys of Apache crashes due to null pointer
dereferencing kick in... *shudder*.
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html