All PHP quizzes
Intermediate30 questions60 minutes

PHP Intermediate Quiz

Explore OOP, error handling, file operations, sessions, databases, and security

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 Object-Oriented Programming in PHP?

  • Code organization
  • Function grouping
  • Object creation
  • Programming paradigm using classes and objects
Show answer

Answer: Programming paradigm using classes and objects. OOP organizes code into classes (blueprints) and objects (instances). Supports encapsulation, inheritance, polymorphism. Modern PHP is heavily object-oriented.

2. How do you define a class?

  • define class ClassName
  • struct ClassName { }
  • object ClassName { }
  • class ClassName { properties and methods }
Show answer

Answer: class ClassName { properties and methods }. Define class with class keyword: class User { public $name; public function greet() {} }. Convention: PascalCase for class names.

3. What is a constructor?

  • First method
  • Setup method
  • Initialization function
  • __construct() method called when object created
Show answer

Answer: __construct() method called when object created. __construct() is magic method called automatically when creating object. Initialize properties: function __construct($name) { $this->name = $name; }. PHP 8 has constructor property promotion.

Frequently asked questions

How many questions are in this PHP quiz?+

30 questions, with a 60-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 intermediate quiz aimed at?+

Explore OOP, error handling, file operations, sessions, databases, and security

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, 60 minutes. Free, no sign-up.

Start now