PHP MCQ Test: PHP MCQs - Practice Questions
1. What is the purpose of the `__invoke()` magic method in PHP?
2. In PHP, what is the use of the `unset()` function?
3. What is the purpose of the `glob()` function in PHP?
4. What does the `static` keyword do in PHP?
5. What is the purpose of the `array_push()` function in PHP?
6. What is the purpose of the magic constant `__DIR__` in PHP?
7. What is the purpose of the `opcache_get_configuration()` function in PHP?
8. Which of the following is a correct way to include a file in PHP?
9. How can you check if a variable is an array in PHP?
10. What is the purpose of the `switch` statement in PHP?
11. What is the purpose of the function `mysqli_connect()`?
12. How can you handle file uploads in PHP securely?
13. Which PHP function is used to redirect the browser to another location?
14. What is the purpose of the `session_regenerate_id()` function in PHP?
15. What is the use of the `filter_var()` function in PHP?
16. How do you include a trait in a PHP class?
17. Which function is used to redirect the browser to another location in PHP?
18. What is the purpose of the `json_encode()` function in PHP?
19. What is the purpose of the `continue` statement in PHP?
20. What is the purpose of the `header('Content-Type: application/json')` function in PHP?
21. What is the purpose of the `hash_pbkdf2()` function in PHP?
22. How do you handle file uploads in PHP?
23. What is the purpose of the `while` loop in PHP?
24. How do you comment out a single line in PHP?
25. What is the purpose of the `FILTER_VALIDATE_EMAIL` filter in PHP?
26. How can you prevent a PHP script from timing out?
27. How do you perform a case-insensitive string comparison in PHP?
28. What is the purpose of the `array_map()` function in PHP?
29. What is the purpose of the `__construct()` method in a PHP class?
30. How do you comment out a single line in PHP?