Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Advanced PHP:
O'Reilly on References
Sep 13, 2002 @ 12:55:20

References can be a slippery concept for someone who has no programming background, especially one with no C-related experience. But, in PHP, they're quite useful for everything from a simple pointer to another variable (instead of a copy) or using them in classes to reference objects. No matter what the use of them is, you still had to start somewhere, and had to learn how to use them. If you chose the first O'Reilly article on references, then you'll be happy to know that, this morning, they've posted a second part to the series.

In this part of the series, they cover things a bit more high-level than in the first portion. They cover returning references (like with $tool=&selectObject(true);) and using references in object constructors (they use it to create a reference back to the current object - $this). They're a bit tough to understand at first, but trust me, once you use them and discover their "magic", they become quite useful.

tagged:

Link:


Trending Topics: