Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
What is the output of the following PHP code snippet?
<?php$i = 1;do { echo $i; $i++;} while ($i <= 5);?>
12345
54321
1234
None of the above
What is the output of the following code snippet?
<?php$x = 5;$y = 10;$z = $x + $y;echo "The sum is: $z";?>
The sum is: 15
The sum is: $z
The sum is: 5 + 10
<?php$myString = "Hello, world!";echo substr($myString, 7);?>
Hello
world!
Hello, w
<?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
include("myfile.php");
require("myfile.php");
include_once("myfile.php");
All of the above
array_shift($myArray);
array_pop($myArray);
unset($myArray[0]);
<?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
if ($myVar == null) { ... }
if ($myVar === null) { ... }
if ($myVar != null) { ... }
<?php$num = 7;if ($num % 2 == 0) { echo "Even";} else { echo "Odd";}?>
Even
Odd
7
define("PI", 3.14);
const PI = 3.14;
PI = 3.14;