Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
if (strpos($myString, "world") !== false) { ... }
if (substr($myString, "world") !== false) { ... }
if ($myString contains "world") { ... }
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
$myArray = array("red", "green", "blue");
$myArray = array(array(1, 2), array(3, 4));
$myArray = array(1, 2, 3 => array("a", "b", "c"));
<?php$x = 5;$y = 10;function myFunction() { global $x, $y; $y = $x + $y;}myFunction();echo $y;?>
5
15
<?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
function myFunction() {}
def myFunction() {}
func myFunction() {}
<?php$myString = "Hello, world!";echo str_replace("Hello", "Hi", $myString);?>
Hi, world!
Hello, world!
Hi
<?php$num1 = 10;$num2 = 5;$result = $num1 + $num2;echo "The result is " . $result;?>
The result is 10
The result is 5
The result is 15
array_shift($myArray);
array_pop($myArray);
unset($myArray[0]);
All of the above
What is the output of the following code snippet?
<?php$a = "Hello";$b = "World";echo $a . " " . $b;?>
HelloWorld
Hello World
Hello "World"