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 conditional statements is/are supported by PHP?
i) if statements
ii) if-else statements
iii) if-elseif statements
iv) switch statements

Only i)
i), ii) and iv)
ii), iii) and iv)
i), ii), iii) and iv)

2. Which of the following are correct ways of creating an array?
i) arr[0] = "letsfindcourse";
ii) $arr[] = array("letsfindcourse");
iii) $arr[0] = "letsfindcourse";
iv) $arr = array("letsfindcourse");

ii), iii) and iv)
ii) and iii)
Only i)
iii) and iv)

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

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

4. Which of the following is a valid session ID in PHP?

1234567890abcdef
session_id_123
A session ID can be any string
All of the above

5. How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.

7
8
9
10

6. In which of the following cases would function empty() return FALSE?

$x; echo empty($x);
$x=FALSE; echo empty($x);
$x=TRUE; echo empty($x);
$x=NULL; echo empty($x);

7. What will be the syntax of defining the class?

class lfc ()
class lfc []
class lfc {}
lfc class{}

8. What is the output of the following php code?

<?php
    $username = "letsfindcourse";
    if (preg_match("([^a-z])",$username))
        echo "Name must be all lowercase!";
    else
        echo "Name is all lowercase!";
    ?>

Error
No Output
Name must be all lowercase!
Name is all lowercase!

9. Which in-built function will add a value to the end of an array?

array_unshift()
into_array()
inend_array()
array_push()

10. Which of the following is the output of the below code?

<?php 
  
var_dump(strpos("Hello letsfindcourse!", "course")); 
    
?>

int(13)
char(14)
int(14)
int(15)

Results