What does an “&” in front of a variable name mean?

Posted 2 years ago

This is a reference to a variables contents, see the example below.


<?php
    $name = 'Chris';
    $pointer = &$namer;   // Sets $pointer as a reference to $name
    echo $name;    // Prints  'Chris'
    $pointer = 'Archie';    // Sets $name to 'Archie'
    echo $name;     // Outputs 'Archie'
?>

See the PHP manual here