-
How do you declare a variable in PHP?
a) $x = 10;
b) variable x = 10;
c) let x = 10;
-
What is the output of the following PHP code snippet?
$x = 10;
echo gettype($x);
$x = "hello";
echo gettype($x);
a) integer and string
b) string and integer
c) integer and integer
-
Which PHP loop is used to iterate over a range of values?
a) for
b) while
c) foreach
-
In PHP, what is used to handle error conditions and exceptions?
a) try
b) catch
c) finally
-
What keyword is used in PHP to throw an exception manually?
a) throw
b) try
c) exception
-
Which PHP function is used for input and output operations?
a) echo
b) print
c) fopen
-
In which programming language is PHP primarily implemented?
a) C++
b) Java
c) PHP
-
What will be the output of the following PHP code?
$a = array(1, 2, 3);
$b = $a;
$b[0] = 5;
echo implode(" ", $a);
a) 1 2 3
b) 5 2 3
c) 1 5 3