PHP Functions
- What will be the output of the following PHP code ?
<?php
function Example($int)
{
if ($int == 10)
echo "First Condition Executed...\n";
if ($int == 20)
echo "Second Condition Executed...";
}
Example(10);
EXAMPLE(20);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Function Is case Insensitive.
- What will be the output of the following PHP code ?
<?php
function fun($number)
{
$number = 5 + $number;
echo $number;
}
fun(7);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Simple arithmetic operation.
- What will be the output of the following PHP code ?
<?php
function Example($d)
{
$d = 12 + $d;
echo "$d";
}
Example(6);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The function is defined as echo “$d”. This means $d is treated as a string and not as a variable.
- What will be the output of the following PHP code ?
<?php
function First($str)
{
echo "This is ". $Str;
}
First("Important");
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Variable Undeclared) $str is not the same as $Str.
- What will be the output of the following PHP code ?
<?php
function TvShow($int)
{
$TvShow = array("Naagin.", "CID.", "Big Boss.");
echo "This is my favourite show ". $TvShow[$int];
}
TvShow(2);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Simple use of arrays.