All PHP quizzes
Beginner30 questions45 minutes

PHP Beginner Quiz

Master PHP basics including syntax, variables, functions, arrays, and control structures

Start the quiz

Sample questions from this quiz

A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.

1. What is PHP?

  • A web framework
  • A JavaScript library
  • A database system
  • Server-side scripting language for web development
Show answer

Answer: Server-side scripting language for web development. PHP (Hypertext Preprocessor) is a popular general-purpose server-side scripting language especially suited for web development. Created by Rasmus Lerdorf.

2. How do you start and end a PHP code block?

  • <? and ?>
  • <?php and ?>
  • {% and %}
  • <php> and </php>
Show answer

Answer: <?php and ?>. PHP code blocks start with <?php and end with ?>. Short tags <? ?> exist but are discouraged. Always use <?php for compatibility.

3. How do you output text in PHP?

  • printf()
  • echo or print
  • output()
  • console.log()
Show answer

Answer: echo or print. Use echo or print to output text. echo can take multiple parameters, print returns 1. Both work, echo is more common and slightly faster.

Frequently asked questions

How many questions are in this PHP quiz?+

30 questions, with a 45-minute time limit. Every question includes a written explanation of the correct answer.

Is this PHP quiz free?+

Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.

What level is the beginner quiz aimed at?+

Master PHP basics including syntax, variables, functions, arrays, and control structures

Can I use this to prepare for a PHP interview?+

Yes. The questions cover the topics that come up in PHP technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.

Ready to test your PHP?

30 questions, 45 minutes. Free, no sign-up.

Start now