I have noticed some WordPress plugin classes pass the class method to a hook using the ampersand prefix.
for example:
add_action( 'somehook', array( &$this, 'some_function' ) );
Is there a specific reason to do so?
I understand the &
makes it pass a reference instead of an instance but most of the time I see it used that seems irrelevant as it is a method and not an object.
Is there a particular reason to do it this way with wordpress action hooks?
It’s just a fallback for PHP4 where objects are passed by values.
Since WordPress requires PHP5.2.4 at least, there’re no reasons to use
&
prefix anymore.