PHP Programming Quiz


Play this quiz that will help you to excel in PHP certification exams, placements etc. This PHP programming quiz consist of 10 questions that you need to solve in 10 minutes. We’ve specially designed this quiz so that you can quickly acquaint to the pattern of questions you can be asked in placement drives, certification exams etc. This PHP programming test enables you to assess your knowledge of PHP programming.

Take the Free Practice Test



PHP MCQs

Practice PHP MCQ Questions, which will help you to clear your PHP Programming related concepts and also helps you to prepare for placements, technical rounds, interviews, competitive exams etc.

PHP Quiz

Try Free PHP Quiz, to start a quiz you need to login first, after login you will get start quiz button and then by clicking on that you can start quiz. You will get 10 Minutes to answer all questions.

PHP Quiz

1. Which of the below statements is equivalent to $sub -= $sub?

$sub = $sub
$sub = $sub -$sub
$sub = $sub - 1
$sub = $sub - $sub - 1

2. Constructor is also called ____ function

find
key
automatic
magic

3. What will be the output of the following PHP code ?

<?php
for ($i = 0; $i < 4; $i++)
{
  for ($j = 0; $j < 3; $j++)
  {
   if ($i > 1)
   continue;
   echo("Hi 
");
  }
}
?>

prints "Hi" 3 times
prints "Hi" 4 times
prints "Hi" 5 times
prints "Hi" 6 times

4. What is the use of array_unshift() function?

Function is used to print the array in readable format.
Adds elements to the beginning of the array and returns the size of array.
Function can be used to verify if a variable is an array. Returns TRUE or FALSE
Adds elements to the end of the array and returns the size of array.

5. The files length can be found using the _______function.

fsize()
fcount()
filesize()
count()

6. Which function returns an array consisting of associative key/value pairs?

count()
array_count()
array_count_values()
count_values()

7. What will be the output of the following PHP code?

<?php
$a = 1;
$b = 2;
$c = 3;
echo ($a % ($b) + $c);
?>

2
3
4
5

8. PHP can create, open, read, write, delete, and close files on the server.

True
False
PHP can only create, open and close files on the server
PHP can read, write and delete files on the server

9. The PHP syntax is most similar to:

VBScript
JavaScript
Perl and C
All of the above

10. A variable $str is set to "HELLO WORLD", which of the following script returns it title case?

echo ucwords($str)
echo ucwords(strtolower($str)
echo ucfirst($str)
echo ucfirst(strtolower($str)

Results