-
What is the value of $a and $b after the function call?
<?php
function doSomething(&$argument)
{
$Result = $argument;
$argument += 1;
return $Result;
}
$n = 5;
$m = doSomething($n);
echo "n = " . $n . " and m = " . $m;
?>
-
- n = 6
- n = 6 and m = 5
- m = 6
- Error
- None of these
Correct Option: B
$n is 6 and $m is 5. The former because $argument is passed by reference, the latter because the return value of the function is a copy of the initial value of the argument.