adplus-dvertising
frame-decoration

Question

What is the value of $a and $b after the function call?
<?php
    function doSomething( &$arg ) {
        $return = $arg;
        $arg += 1;
        return $return; 
    }
    $a = 3;
    $b = doSomething( $a );
    ?>

a.

a is 3 and b is 4

b.

a is 4 and b is 3

c.

Both are 3

d.

Both are 4

Posted under Basics of PHP PHP

Answer: (b).a is 4 and b is 3

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the value of $a and $b after the function call?

Similar Questions

Discover Related MCQs

Q. If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed?

Q. Which of the looping statements is/are supported by PHP?

i) for loop
ii) while loop
iii) do-while loop
iv) foreach loop

Q. Which of the conditional statements is/are supported by PHP?

i) if statements
ii) if-else statements
iii) if-elseif statements
iv) switch statements

Q. Which of the below symbols is a newline character?

Q. Which statement will output $x on the screen?

Q. Which of the below statements is equivalent to $add += $add ?

Q. Which of the following PHP statements will output Hello World on the screen?

i) echo (“Hello World”);
ii) print (“Hello World”);
iii) printf (“Hello World”);
iv) sprintf (“Hello World”);

Q. Which of following variables can be assigned a value to it?

i) $3hello
ii) $_hello
iii) $this
iv) $This

Q. Which of the following php statement/statements will store 111 in variable num?

i) int $num = 111;
ii) int mum = 111;
iii) $num = 111;
iv) 111 = $num;

Q. We can use ___ to comment a single line?
i) /?
ii) //
iii) #
iv) /* */

Q. Which version of PHP introduced Try/catch Exception?

Q. Which of the following must be installed on your computer so as to run PHP script?

i) Adobe Dreamweaver
ii) PHP
iii) Apache
iv) IIS

Q. Which of the following is/are a PHP code editor?

i) Notepad
ii) Notepad++
iii) Adobe Dreamweaver
iv) PDT

Q. A PHP script should start with ___ and end with ___

Q. PHP files have a default file extension of_______

Q. What does PHP stand for?
i) Personal Home Page
ii) Hypertext Preprocessor
iii) Pretext Hypertext Processor
iv) Preprocessor Home Page

Q. In compile time installation PHP offers some

Q. Which is most important thing in configuration of PHP?

Q. To define a function with default arguments, simply you need to turn formal parameter names into

Q. Which one from followings is used for configuring PHP?