Re: Is it worth it to return a resource by reference?
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Wed, 27 Sep 2006 17:51:08 -0400
Ney André de Mello Zunino wrote:
Jerry Stuckle wrote:
Passing by reference should never increase the amount of overhead (at least not by any measurable amount), even for an integer. And for more complex objects it will decrease the overhead.
Thanks for your reply. Given that the use of references can never hurt and that this is my first time using them, could you tell me if I am doing it right (according to the sample code in my original post)?
Thank you,
Yep. That's how you return a reference. The only comment which is actually only a matter of style is the generally used syntax is:
function &getPosts(...)
That is, the '&' goes just before the function name instead of immediately after the 'function' keyword. However, it's a matter of style, and either should work.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- Is it worth it to return a resource by reference?
- From: Ney André de Mello Zunino
- Re: Is it worth it to return a resource by reference?
- From: Jerry Stuckle
- Re: Is it worth it to return a resource by reference?
- From: Ney André de Mello Zunino
- Is it worth it to return a resource by reference?
- Prev by Date: Re: mbstring extension not found; how to find it?
- Next by Date: open source ajax/php html editors?
- Previous by thread: Re: Is it worth it to return a resource by reference?
- Next by thread: why is which not working?
- Index(es):
Relevant Pages
|