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
for($i=0; $i<=5; $i++){
    $i = $i+1;
}

echo "$i";
?>

5
6
7
8

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

define('IF', 42); 
echo ""IF: "", IF;

IF:42
No output
IF:
Error

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

<?php
$arr = array('0' => "Letsfindcourse", 
             '1' => "Computer",  
             '2' => "Science", 
             '3' => "Portal"); 

print_r($arr[0]); 
?>

Portal
Letsfindcourse
Error
No Output

4. Any variables declared in PHP must begin with a _____?

.
#
&
$

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

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

Error
No Output
infinite loop
4

6. How many different data types are available in php?

6
7
8
9

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

<?php  
  
for ($num = 1; $num <= 10; $num += 2) { 
    echo "$num "; 
}  
  
?>

1 3 5 7 9
1 2 3 4 5
9 7 5 3 1
Error

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

<?php
class letsfindcourse 
{     
    public $lfc_name = "letsfindcourse"; 
      
    
    public function __construct($lfc_name) 
    { 
        $this->lfc_name = $lfc_name; 
    } 
} 


$lfc = new letsfindcourse("letsfindcourse");  
echo $lfc->lfc_name; 

?> 

letsfindcourse
1
Error
No Output

9. A variable can have ________?

long descriptive names
short names
Both A and B
None of the above

10. Which is the error level to report probable run-time errors?

E_ERROR
E_NOTICE
E_CORE
E_USER_ERROR

Results