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. Predict the output of the following code snippet :

<?php
function sample()
	{
	$var1=20;
	echo $var1;
	echo $GLOBALS['var1'];
	}
$var1=10;
sample();
echo $var1;
?>

201010
202010
101010
201020

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

<?php
$a = "Hello";
$b = "World";
echo "$a"+"$b";
?>

HelloWorld
Hello+World
0
Error

3. If an attempt to open a file fails then fopen returns a value of ?

TRUE
FALSE
Can be true or false
Can not say

4. Ord ( ) function is used convert a ______.

Integer type into a string
Integer type into an array
Float type into an array
Array type into a string

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

<?php 
    $title = "O malley wins the heavyweight championship!";
    echo ucwords($title);
?>

O Malley Wins The Heavyweight Championship!
O malley Wins The Heavyweight Championship!
O Malley wins the heavyweight championship!
o malley wins the heavyweight championship!

6. 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)

7. _________ function is used to read a constant value.

read()
get()
constant()
define()

8. What is the use of htmlentities() function in php?

Converts characters to HTML entities
Converts HTML entities to characters
Converts some predefined HTML entities to characters
Converts some predefined characters to HTML entities

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

<?php
echo "This is  "echo statement" ";
?>

This is "echo statement"
echo statement
Error
No Output

10. A function in PHP which starts with double underscore is known as __________.

Magic Function
Inbuilt Function
Default Function
User Defined Function

Results