function add_one($number) {
$number++;
}
$number = 1;
add_one($number);
print "$number\n";
1
If the variable was passed by reference, the value of
$number would be 2.
In many languages, passing variables by reference also has the
additional benefit of being significantly faster than by value. While
this is also true in PHP, the speed difference is marginal. For that
reason, we suggest passing variables by reference only when actually
necessary and never as a performance-enhancing trick.