PHP Quiz
Check what you have learned in this PHP tutorial. Answer each question, then read the explanation.
How to Use This Quiz
- Try to answer without looking back at the lessons
- If you get one wrong, open that lesson again and run its examples
- Aim for at least 8 correct answers out of 10
Quiz Questions
Exercise
1. What does PHP produce and send to the browser?
Exercise
2. Which symbol starts every PHP variable name?
Exercise
3. Which operator joins two strings in PHP?
Exercise
4. What does this print? $x = 7; echo $x % 3;
Exercise
5. Which PHP 8 feature returns a value, uses strict comparison and needs no break?
Exercise
6. How many times does this loop run? for ($i = 0; $i < 4; $i++) { }
Exercise
7. Which function counts the items in an array?
Exercise
8. Which superglobal holds data from a form sent with method="post"?
Exercise
9. What must you call at the top of a page before using $_SESSION?
Exercise
10. In PDO, what protects your database from SQL injection?
What Next?
Well done on finishing PHP! Build a small project, such as a student result system or a shop price list with a MySQL database. Then explore a framework like Laravel, and keep your code safe with Git.
