Tutorials › PHP Tutorial › PHP Quiz

PHP Quiz

15 min read · Lesson 24 of 24

Test what you have learned in this PHP tutorial. Each question has exactly one correct answer. If you get one wrong, revisit the lesson linked in the list below, then try again.

Quiz 15 questions
1. Where does PHP code run?
2. Which of these is a valid PHP variable name?
3. What does this code print? $x = 5; echo "Value: $x";
4. Which operator joins two strings together?
5. What is the result of var_dump(5 === "5");?
6. What does $name = $_GET["name"] ?? "Guest"; do?
7. Which statement about match (PHP 8) is true?
8. Which loop is designed for walking through every element of an array?
9. A global variable is not visible inside a function. Which keyword lets the function use it?
10. Which function should you use when printing user input into an HTML page?
11. What is the safest way to run a SQL query that contains user input with PDO?
12. What is the main difference between include and require?
13. Which function must be called before you can use $_SESSION?
14. Inside a class method, what does $this refer to?
15. How should passwords be stored in the database?

What next?

Congratulations on finishing the PHP tutorial! Good next steps:

  • Build a small project from start to finish, such as a student registration system with login, a dashboard and a MySQL table.
  • Learn Composer, PHP's package manager, and try a framework such as Laravel.
  • Deploy your project to real hosting (cPanel or a VPS) and enable HTTPS.
  • Practise SQL in our SQL tutorial so your database queries become second nature.
Sign in or create a free account to track progress, earn XP, badges and a certificate.