NYCPHP Meetup

NYPHP.org

[nycphp-talk] Minor rant, pass by reference during method invocation depreciated

Paul Bouzakis nyphp at zooluserver.com
Fri Jul 2 12:57:41 EDT 2010


My understanding is that the only reason the code in joomla is passing 
objects by reference in the code (preceding ampersand) is because in 
php4 objects were NOT passed by reference.

So if you know you are running a php5 machine, you dont need to worry 
about this.

On 7/2/2010 12:23 PM, Gary Mort wrote:
>
>
> On Fri, Jul 2, 2010 at 10:58 AM, John Campbell <jcampbell1 at gmail.com 
> <mailto:jcampbell1 at gmail.com>> wrote:
>
>     > $grantUser object updated with the new levels or not. If I know
>     I am dealing
>     > with the current user, than I want the admin authority to
>     immediately be
>     > applied so it will flow to all future function calls:
>     > $return= Application::setUserRole(&$grantUser, USER_ADMIN);
>     > Wheras if I am dealing with the previous user, I may very well
>     want to keep
>     > the original user to see if any changes where made:
>     > $return = Application::setUserRole($grantUser, USER_ADMIN);
>
>     Objects are always passed by reference.  You don't have a choice.
>
>
> Cool, thanks for the clarification.  In that case I can always assume 
> pass by reference and simply clone when you need to avoid making changes.
>
> Well, except for strings and ints, but I rarely care about them.
>
>
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/Show-Participation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20100702/2a88984e/attachment.html>


More information about the talk mailing list