Examveda
Examveda

What will be the output of the following PHP code ?
<?php
function mine($num)
{
    $num = 2 + $num;
    echo "$num";
}
mine(3);
?>

A. 3

B. $num

C. 5

D. None of the mentioned

Answer: Option B

Solution(By Examveda Team)

The function is defined as echo “$num”.This means $num is treated as a string and not as a variable.

This Question Belongs to PHP >> Functions

Join The Discussion

Comments ( 1 )

  1. Raham Sher
    Raham Sher :
    4 years ago

    Its result will be 5.Kindly check & verify.I myself checked & verify it.

Related Questions on Functions