PHP is a server side scripting language that allows quick development of dynamic web application.
PHP code can be embedded into HTML source document which later interpreted by PHP module to generate web pages.
| Questions: | 9 |
| Attempts allowed: | Unlimited |
| Available: | Always |
| Pass rate: | 75 % |
| Backwards navigation: | Allowed |
This PHP quiz contains questions for PHP developers to test their knowledge in the PHP language.
This is a free online PHP quiz.
PHP language is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
Start quiz
Multiple choice question
If a return statement is omitted from a function, what value will be returned as the function terminates?
Multiple choice question
Which of the following functions, gets a separator string and a target string as arguments and returns an array of strings?
True/false question
What is the return value of ‘is_array’ function which gets ArrayObject as parameter?
Multiple choice question
Which keyword is used to refer to the current instance of a class?
Multiple choice question
It is known that any user generated string value needs to be escaped before using it and especially in a MySQL queries (to prevent SQL injection).
Is it a problem to use un-escaped database retrieved value in a new query to the database?
Multiple choice question
Given the following PHP code, what will be the output?
$t;
if (isset($t))
echo "t is set";
else
echo "t is not set";
Multiple choice question
Given the following PHP code, what will be the output?
function print_weather($weather){
if ($weather =="hot")
$weather_id = 0;
else if ($weather =="cold")
$weather_id = 1;
else
$weather_id=null;
if ($weather_id == null)
echo "Nice weather; ";
else
echo "Extreme weather; ";
}
print_weather("hot");
print_weather("cold");
print_weather(null);
Multiple choice question
How can a function return an array in PHP?
Multiple choice question
PHP arrays are a useful way to handle series of variables. An array can hold another array.
What will be the output of the following code?
$tops = array(
0=>array("user_id"=>34, "user_name"=>"Dan"),
1=>array("user_id"=>35, "user_name"=>"Ben"),
2=>array("user_id"=>36, "user_name"=>"Roy"));
foreach ($tops as $key=>$top){
$top["user_id"] = $key;
}
echo " {$tops[0]["user_id"]} ";