028 - function arguments by referenceThis is a string, Original Value is 10
Changed Value is 16
<?php
// 028 - function arguments by reference ( if reassing the passing value in function it will change)
echo "</br><span class='myheading'>028 - function arguments by reference</span></br>";
function testing_028($string_028) { /* function argument By Value */
$string_028 .= 'and something extra.';
}
$str_028 = 'This is a string, ';
testing_028($str_028);
echo $str_028; // normally print is value
function first_028($num_028) { /* function argument By Value*/
$num_028 += 5;
}
function second_028(&$num_028) { /* function argument By Reference*/
$num_028 += 6;
}
$number_028 = 10;
first_028( $number_028 );
echo "Original Value is $number_028<br />";
second_028( $number_028 );
echo "Changed Value is $number_028<br />"; // update the value coz it works on the address
?>