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. What will be the output of the following PHP code?

<?php  
$num = 20; 
  
while ($num < 12) { 
    $num += 2; 
    echo $num, "\n"; 
} 
?>

Error
No Output
infinite loop
Only one garbage value

2. The spliti() function operates exactly in the same manner as its sibling split(), except that it is not case sensitive.

TRUE
FALSE
Can be true or false
Can not say

3. What is use of expression p$?

It matches any string containing zero or more p's.
It matches any string containing zero or one p's.
It matches any string with p at the end of it.
It matches any string with p at the beginning of it.

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

class myObject { }
define('myObject::CONSTANT', 'test');
echo myObject::CONSTANT;

test
error
myObject::CONSTANT
no output

5. Echo statement is written under parentheses?

True
False
Only for string it written under parentheses
Only for variable it written under parentheses

6. Predict the output of the following code.

<?php

$a=array(1,2,3,5,6);
next($a);
next($a);
next($a);
echo current($a);

?>

2
3
4
5

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

<?php 
class letsfindcourse 
{ 
    
    public function __construct(){ 
        echo 'The class "' . __CLASS__ . '" was initiated!<br>'; 
    } 
      
} 
   
$lfc = new letsfindcourse; 
?>

The class letsfindcourse was initiated!<br>
The class lfc was initiated!<br>
Error
No Output

8. A function name cannot start with a ____

alphabet
underscore
number
Both C and B

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

<?php 
   $url = "lfc123456@example.com";
   echo ltrim(strstr($url, "@"),"@");
?>

lfc123456@example.com
lfc123456
lfc123456@
example.com

10. The PHP function searches for a specific text within a string.

strpos()
strposition()
strrev()
str_replace()

Results