We know that we can pass values called parameters to functions. We call it arguments by value. We can pass arguments by reference also.
Let's explain with example.
Function number_display contains a parameter number that has a value 10. Please have a look at the argument of the function statement. The argument $no preceeded with the & operator which indicates the argument is accepted by reference.
$number = 10;
number_display($number);
echo $number;
function number_display(&$no)
{
$no += 10;
}
By reference means by the location of the actual variable. So, we are passing the memory address location of the parameter.
Generally when we are passing a value to a function, the function argument is accepted by copying the actual or original value. So, the original value remains same.
But in case of arguments by reference, we are passing the address location of the variable. So, the original value is referring or pointing. If we are updating the value it will affect the original value.
Conclusion, if we don't bother to keep updating the original value by function then we can use arguments by reference, else arguments by value.