What does an Ampersand sign before a PHP function declaration mean?

February 18, 2011    ampersands php

Only found this out today, thought I would blog it just to be helpful.

If you put an ampersand before your function name, the function will return a reference to a variable instead of the value.

For example

function &getmyname(){
    //im a function that your copying my instances of

$instance =& getmyname();

blog comments powered by Disqus