What Will Be The Value Of A And B After The Function Call In #29
What will be the value of $a and $b after the function call in the following PHP code?</p> <pre><code class="language-php" line="1"> <?php function doSomething( &$arg ) { $return = $arg; $arg += 1; return $return; } $a = 3; $b = doSomething( $a ); ?> </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs107 PHP: Hypertext Preprocessor. It can also be found in gs gs107 PHP Basics - PHP Basics - Quiz No.3.
What will be the value of $a and $b after the function call in the following PHP code?
<?php function doSomething( &$arg ) { $return = $arg; $arg += 1; return $return; } $a = 3; $b = doSomething( $a ); ?>
a is 3 and b is 4
a is 4 and b is 3
Both are 3
Both are 4