In case of call by reference, actual value is modified if it is modified inside the function. In such case, we need to use &
symbol with formal arguments. The &
represents reference of the variable.
Example:
function adder(&$str2) {
$str2 .= 'Call By Reference';
}
$str = 'This is ';
adder($str);
echo $str;
Output:
This is Call By Reference