Community

When to use byref argument in a function?

When I develop a component for Webform module. I used the "function hook_webform_component_info_alter(&$components) " to add a new component, but failed, instead, used the "function hook_webform_component_info()", it worked!

So I was completely confused when to use byref argument in a hook function. Because a byref parameter should be used as altering the existing content.

In other words, is there a general rule for using byref argument or not?

Thanks!

Comments

Those are two different

Those are two different functions. One takes the argument, one doesn't. Use the argument for the function that takes the argument, don't use the argument for the function that doesn't.

Jaypan We build websites

nobody click here