PHP Quiz

The PHP practice quiz is designed to quiz you knowledge about one of the most common server-side languages in the world. PHP contains many different functions and is always evolving, but this practice quiz will show you how well you know the fundamentals of PHP.

1. Which of the following can PHP NOT do?


2. Between which tags is PHP code written?


3. Which of the following is NOT a valid comment in PHP?


4. What is a valid PHP variable name?


5. How do you join strings in PHP?


6. Which of the NOT a valid assignment operator in PHP?


7. What is the difference between an include and a require in PHP?


8. What keyword(s) can you use to add an alternative condition to an if statement that executes different code?


9. Which of the following is NOT a valid if statement?


10. Which of the following is the valid way to start a function in PHP?


11. Which of the following keywords is used to start a conditional in a PHP switch statement?


12. Which of the following is a valid way to start a for loop in PHP that would print out the numbers 0 through 4?


13. How do you create an array in PHP?


14. What keyword can you use to exit out of a loop and continue onto the next code after the loop?


15. Which of the following variables can NOT be used to obtain the form data after a form is submitted?


16. What function can you use to get the position of a string or character inside a string?


17. What function can you use to break a string with a sentence into an array of words?


18. How would you open a file to read from it in PHP?


19. How would you read the first 20 characters of a file if the variable $a contains the link to the file?


20. How do you write contents to a file?


21. What function do you use to delete a file in PHP?


22. What function can you use to transfer an uploaded file to a new location?


23. How how do you connect to a MySQL database using PHP’s PDO class?


24. What function do you use to get your PDO object ready to run a query?


25. What function do you use to run a query using a PDO object?


Question 1 of 25

If you enjoyed this resource, support me by sharing this page with others.
Share on Facebook
Share on StumbleUpon
Digg this
Tweet about this on Twitter
Share on Reddit