NYCPHP Meetup

NYPHP.org

[nycphp-talk] What does function &get_ref() {} do?

crisscott at netzero.com crisscott at netzero.com
Wed Sep 3 09:31:44 EDT 2003


> doesn't this need global $var_1,$var_2; in the swap function?

No.  Normally variables passed to functions are just copies used in the function scope.  When something is passed by reference (&$var), you are telling the function where to find the original variable.  When a function uses a variable reference it can make changes to that variable outside of its own scope.  



More information about the talk mailing list