Questions
PHP questions
Choose a question page, learn the concept, then test your understanding with a quiz.
Multithreading and Concurrent Processing in PHP Applications
Learn practical PHP concurrency using worker processes, pcntl, proc_open, job queues, and the parallel extension without leaking processes.
Override a PHP Trait Method and Call the Original Method
Learn how to override a PHP trait method while preserving access to its original implementation through trait method aliases.
PDO bindParam vs bindValue in PHP: Key Differences
Learn the difference between PDOStatement::bindParam() and bindValue() in PHP, including references, execution timing, examples, and common mistakes.
PHP Array Constants: Defining Immutable Role Lists
Learn how to define array constants in modern PHP, choose compatible alternatives for older versions, and avoid fragile string-and-explode patterns.
PHP Associative Arrays: Add Keys and Values Correctly
Learn how to add key-value pairs to PHP associative arrays, why array_push does not accept keys, and how to parse query strings safely.
PHP Closures and the use Keyword Explained
Learn what PHP closures are, how anonymous functions work, and why the use keyword imports outer variables by value or reference.
PHP Code Displayed Instead of Executed: Server Configuration and PHP Tags
Learn why PHP code can appear in browser source instead of executing, including PHP handlers, file paths, short tags, and XAMPP checks.
PHP Date and Time Formatting Like MySQL NOW()
Learn how to generate a MySQL NOW()-style datetime string in PHP using date() and understand formatting, timestamps, and common mistakes.
PHP Elvis Operator (?:) vs Null Coalescing Operator (??)
Learn the difference between PHP's short ternary operator (?:) and null coalescing operator (??) with examples, edge cases, and best practices.
PHP Enumerations: How to Model Enums Before and With Native Enums
Learn how to represent enumerations in PHP, common workarounds, native enum syntax, and when to use constants or enum classes.
PHP Equality vs Identity: Understanding == and ===
Learn the difference between PHP == and ===, how loose and strict comparisons work, and when to use each with clear examples.
PHP Error Log Location: Apache, FastCGI, and cPanel
Learn how PHP chooses an error log location with Apache, FastCGI, and cPanel, and how to find or configure it through php.ini.
PHP Error Reporting and Displaying Errors in the Browser
Learn how PHP error_reporting and display_errors work, why errors appear in logs but not the browser, and how redirects can hide PDO exceptions.
PHP Maximum Execution Time Exceeded: Diagnose and Fix Long-Running Scripts
Learn why PHP scripts exceed maximum execution time, how to diagnose slow loops and downloads, and safely use timeouts, batching, and pagination.
PHP Newline Characters: Single vs Double Quotes
Learn why PHP prints \r\n literally in single quotes and how to create real newline characters for text files, browsers, and Windows Notepad.
PHP Null Coalescing Operator (??): Meaning, Usage, and Examples
Learn what the PHP null coalescing operator (??) means, how it differs from isset() and ?:, and how to use it safely in real code.
PHP Random String Generator: Return Values, Scope, and Correct String Building
Learn how to generate a random string in PHP, fix scope mistakes, and build strings correctly with practical examples.
PHP Short Tags Explained: Should You Use `<?` and `<?=` in PHP?
Learn when PHP short tags are acceptable, why they are discouraged, and how `<?`, `<?=`, and `<?php` differ in real projects.
PHP Static Code Analysis: Finding Bugs Beyond Syntax
Learn how PHP static analysis finds type errors, undefined variables, dead code, and style issues before runtime, with practical PHP examples.
PHP String Increment in for Loops: Why a to z Continues
Learn why PHP string increment makes a for loop continue after z, how string comparisons work, and reliable ways to print letters A to Z.