Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
foreach ($myArray as $value) { ... }
foreach ($myArray as $key) { ... }
foreach ($myArray as $key => $value) { ... }
None of the above
What is the output of the following PHP code snippet?
<?php$num1 = 10;$num2 = 5;if ($num1 > $num2) { echo "$num1 is greater than $num2";} else { echo "$num2 is greater than $num1";}?>
10 is greater than 5
5 is greater than 10
10
<?php$myVar = true;if ($myVar) { echo "The variable is true";} else { echo "The variable is false";}?>
The variable is true
The variable is false
1
What is the output of the following code snippet?
<?php$a = "Hello";$b = "World";echo $a . " " . $b;?>
HelloWorld
Hello World
Hello "World"
<?php$i = 1;while ($i <= 5) { echo $i; $i++;}?>
1 2 3 4 5
1 2 3 4
1 2 3
$myArray = array("red", array("green", "blue"), "yellow");
$myArray = array("red", "green", "blue", "yellow");
$myArray = array(array("red", "green"), array("blue", "yellow"));
if (strpos($myString, "world") !== false) { ... }
if (substr($myString, "world") !== false) { ... }
if ($myString contains "world") { ... }
define("MY_CONST", "Hello");
const MY_CONST = "Hello";
MY_CONST = "Hello";
sort($myArray, "ASC");
asort($myArray);
ksort($myArray);
$my_var
1var
my-var
my var