Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does & before the function name signify?

Tags:

What does the & before the function name signify?

Does that mean that the $result is returned by reference rather than by value? If yes then is it correct? As I remember you cannot return a reference to a local variable as it vanishes once the function exits.

function &query($sql) {  // ...  $result = mysql_query($sql);  return $result; } 

Also where does such a syntax get used in practice ?

like image 315
Zacky112 Avatar asked Jul 15 '10 12:07

Zacky112


People also ask

What does the fox say Meaning?

Speaking of the meaning of the song, Vegard characterizes it as coming from "a genuine wonder of what the fox says, because we didn't know". Although interpreted by some commentators as a reference to the furry fandom, the brothers have stated they did not know about its existence when producing "The Fox".

What does a real fox say?

One of the most common fox vocalizations is a raspy bark. Scientists believe foxes use this barking sound to identify themselves and communicate with other foxes. Another eerie fox vocalization is a type of high-pitched howl that's almost like a scream.

How can I find a song by the sound?

On your phone, touch and hold the Home button or say "Hey Google." Ask "What's this song?" Play a song or hum, whistle, or sing the melody of a song. Hum, whistle, or sing: Google Assistant will identify potential matches for the song.


1 Answers

Does that mean that the $result is returned by reference rather than by value?

Yes.

Also where does such a syntax get used in practice ?

This is more prevalent in PHP 4 scripts where objects were passed around by value by default.

like image 198
BoltClock Avatar answered Oct 03 '22 02:10

BoltClock