CSE :: PHP - CS
-
What will be the output of the following PHP code?
<?php
$num = 10;
echo 'What is her age? \n She is $num years old';
?>
- Which of the conditional statements is/are supported by PHP? 1. if statements 2. if-else statements 3. if-elseif statements 4. switch statements
-
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";
}
?>
-
Which of the looping statements is/are supported by PHP?
1. for loop
2. while loop
3. do-while loop
4. foreach loop -
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]);
}
?>
-
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 );
?>
- How does the identity operator === compare two values?
A.
It converts them to a common compatible data type and then compares the resulting values |
B.
It returns True only if they are both of the same type and value |
C.
If the two values are strings, it performs a lexical comparison |
D.
It bases its comparison on the C strcmp function exclusively |
E.
It converts both values to strings and compares them |