Symfony 7 – PHP – PHP API up to 8.2

20 multiple-choice questions focused strictly on the PHP core/API up to version 8.2.


Question 1: What does declare(strict_types=1) change in a PHP file?

Question 2: How does match differ from switch in PHP?

Question 3: What is the behavior of the nullsafe operator (?->)?

Question 4: What does the null coalescing operator (??) do?

Question 5: What does the null coalescing assignment (??=) do?

Question 6: Which statement about named arguments is correct?

Question 7: How are union types written in PHP?

Question 8: What do Disjunctive Normal Form (DNF) types allow in PHP 8.2?

Question 9: What does declaring a class as readonly in PHP 8.2 enforce?

Question 10: How are dynamic properties treated in PHP 8.2 by default?

Question 11: What is the purpose of #[AllowDynamicProperties]?

Question 12: What does #[SensitiveParameter] achieve?

Question 13: Which is the correct way to store and verify passwords in PHP?

Question 14: How do you make json_decode throw on malformed JSON?

Question 15: Which is the standard way to validate an email string?

Question 16: Which function provides cryptographically secure integers?

Question 17: How should you compare MACs (message authentication codes) safely?

Question 18: What is a key advantage of DateTimeImmutable over DateTime?

Question 19: Which function should you use to get multibyte-safe string length?

Question 20: What is the main purpose of array_map compared to array_walk?