21. Which of the below symbols is a newline character?
22. What will be the output of the following PHP code?
<?php
$num = 10;
echo 'What is her age? \n She is $num years old';
?>
<?php
$num = 10;
echo 'What is her age? \n She is $num years old';
?>
23. Which of the conditional statements is/are supported by PHP?
1. if statements
2. if-else statements
3. if-elseif statements
4. switch statements
24. What will be the output of the following PHP code?
<?php
$team = "arsenal";
switch ($team)
{
case "manu":
echo "I love man u";
case "arsenal":
echo "I love arsenal";
case "manc":
echo "I love manc";
}
?>
<?php
$team = "arsenal";
switch ($team)
{
case "manu":
echo "I love man u";
case "arsenal":
echo "I love arsenal";
case "manc":
echo "I love manc";
}
?>
25. Which of the looping statements is/are supported by PHP?
1. for loop
2. while loop
3. do-while loop
4. foreach loop
1. for loop
2. while loop
3. do-while loop
4. foreach loop
26. What will be the output of the following PHP code?
<?php
$user = array("Ashley", "Bale", "Shrek", "Blank");
for ($x=0; $x < count($user); $x++)
{
if ($user[$x] == "Shrek") continue;
printf ($user[$x]);
}
?>
<?php
$user = array("Ashley", "Bale", "Shrek", "Blank");
for ($x=0; $x < count($user); $x++)
{
if ($user[$x] == "Shrek") continue;
printf ($user[$x]);
}
?>
27. If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed?
28. 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 );
?>
<?php
function doSomething( &$arg )
{
$return = $arg;
$arg += 1;
return $return;
}
$a = 3;
$b = doSomething( $a );
?>