PHP MCQ
Test your PHP knowledge with 100 multiple choice questions covering fundamentals to advanced concepts, with instant feedback and explanations.
What does PHP stand for?
2How do you start a PHP block of code?
3How do you declare a variable in PHP?
4Which function outputs text in PHP?
5How do you write a single-line comment in PHP?
6What is the concatenation operator in PHP?
7How do you create an array in PHP?
8What does isset() do?
9What is the difference between == and === in PHP?
10How do you define a function in PHP?
11What does the count() function do?
12Which PHP superglobal contains form data sent via POST?
13What is a PHP class?
14What does $this refer to inside a PHP class method?
15How do you inherit from a class in PHP?
16What is the purpose of the __construct() method?
17What does the include statement do?
18What is the output of var_dump(true)?
19How do you access a value from an associative array?
20What does PHP's null coalescing operator ?? do?
21What is the difference between array_push() and $arr[] = ?
22What is a PHP interface?
23What is the scope of a variable defined inside a PHP function?
24How do you convert a string to an integer in PHP?
25What does empty() check in PHP?
26What is the purpose of PHP sessions?
27How do you call a static method in PHP?
28What does the foreach loop do in PHP?
29What is the PHP spaceship operator <=>?
30What does htmlspecialchars() do?
31What does the ternary operator look like in PHP?
32What is a PHP trait?
33What does unset() do?
34Which function sorts an array in ascending order?
35What is PHP's PDO?
36What does the print_r() function do?
37What is PHP type juggling?
38What does declare(strict_types=1) do?
39What are PHP magic methods?
40What does str_replace() do?
What is the difference between abstract class and interface in PHP?
2What is a PHP closure?
3What is PHP's late static binding?
4What is dependency injection in PHP?
5What is a PHP generator?
6What does PHP's array_map() do?
7What are named arguments in PHP 8?
8What is the match expression in PHP 8?
9What is PHP's Fibers feature (PHP 8.1)?
10What is PHP's union type declaration?
11What are PHP attributes (PHP 8)?
12What does PHP's null safe operator ?-> do?
13What is the difference between include_once and require_once?
14What is a PSR in PHP?
15What is PSR-4 autoloading?
16What is PHP's match expression's advantage over switch?
17What is a PHP readonly property (PHP 8.1)?
18What does PHP's splat operator ... do?
19What is the difference between array_merge() and array + array?
20What is PHP's object cloning?
21What is a PHP enumeration (Enum) added in PHP 8.1?
22What is PHP's SPL (Standard PHP Library)?
23What is PHP's type coercion in strict mode?
24What is the purpose of PHP's Composer?
25What is PHP's arrow function (fn)?
26What does PHP's intl extension provide?
27What is PHP's Reflection API used for?
28What is PHP's session fixation vulnerability?
29What is PHP's Inversion of Control (IoC) container?
30What is the difference between PHP's header() and setcookie()?
31What is PHP's array_walk() function?
32What does PHP's compact() do?
33What is the purpose of PHP's final keyword on methods?
34What is PHP's abstract static method debate?
35What is PHP's output buffering?
36What is PHP's DateTimeImmutable class?
37What is PHP's splat in array unpacking?
38What is PHP's first class callable syntax (PHP 8.1)?
39What is PHP's fibers vs generators distinction?
40What is the PHP serialize() vs json_encode() for data persistence?
What is PHP's OPcache and how does it improve performance?
2What is the PHP Fibers API and how does it differ from async/await?
3What is PHP's Just-In-Time (JIT) compiler introduced in PHP 8?
4How does PHP handle object references vs value copies?
5What is PHP's weak map (WeakMap in PHP 8)?
6What are PHP intersection types (PHP 8.1)?
7What is PHP's copy-on-write mechanism for arrays?
8What is PHP's zval structure?
9What is PHP's named arguments interaction with function signature changes?
10What is a Psalm or PHPStan and how do they differ from PHP's runtime type checks?
11What is PHP's memory_limit and how does it interact with memory-heavy operations?
12How does PHP's session save handler work and how can it be customized?
13What are PHP SPL data structures and their advantages over arrays?
14What is PHP's preloading feature (PHP 7.4+)?
15What is PHP's named arguments interaction with variadic functions?
16What is PHP's match expression behavior with no matching arm?
17What is PHP's "never" return type?
18What is a PHP decorator pattern using __call?
19What is the behavior of PHP's loose comparison with "0" and false?
20What is PHP's static analysis type system compared to TypeScript?