Jump to content

function /w preceding ampersand


saf

Recommended Posts

Hi

I recently came across a function in one of the php books and didn't have a clue as to why someone would use an ampersand before a function name.

[code]
function &test($var){
  $result = $var+1;
  return $result;
}
[/code]

Can anyone explain what the purpose of the ampersand (&) is (I'd prefer an example of it)?

Thanks,
Saf
Link to comment
https://forums.phpfreaks.com/topic/31421-function-w-preceding-ampersand/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.