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 following expression matches any string containing at least one p?

p*
p-
p^
p+

2. By default, a constant is _________.

case-sensitive
case-insensitive.
Both A and B
None of the above

3. 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

4. Operator ++ indicate?

Decrement operator
Increment operator
Modulus Operator
None of the above

5. 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

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

7. The ________ function compares the two strings s1 and s2, ignoring the case of the characters.

strtolower()
toLowerCase()
strcasecmp()
lc()

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

<?php
$a = 10;
$b = $a>2?"Hi":"Bye";
echo "$b";
?>

HiBye
Bye
Hi
Error

9. Operator ? Means?

Assignment Operators
Modulus AND assignment operator
Conditional Operator
Divide AND assignment operator

10. how to declare strict requirement in php 7?

select(strict_types=1);
declare(strict_types=0);
declare(strict_types=1);
select(strict_types=0);

Results