>>>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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php