[wp-hackers] Why pass by reference?

Micky Hulse mickyhulse.lists at gmail.com
Fri Jul 12 19:59:59 UTC 2013


For the second example:


Why pass $this by reference? Specifically:


Occasionally, I'll see WP example code (like above) where the author
passes $this by reference.

Other examples, like:


... $this isn't passed by reference.

Sorry if this is a dumb question, but (within the context of coding
OOP for WP) how do I determine if I need to pass $this by reference?
Is there a good WP/PHP rule of thumb?

For the add_meta_box() example, I don't see any obvious reasons why
passing by reference is required and/or better than not. :D


More information about the wp-hackers mailing list