Questions
PHP questions
Choose a question page, learn the concept, then test your understanding with a quiz.
Are PDO Prepared Statements Enough to Prevent SQL Injection in PHP?
Learn how PDO prepared statements prevent SQL injection in PHP, what they protect, and the mistakes that still leave MySQL apps vulnerable.
Can You Bind an Array to an IN Clause in PHP PDO?
Learn how PDO handles placeholders in IN() clauses, why arrays cannot be bound directly, and the safe PHP pattern to build dynamic queries.
Choosing the Right MySQL Collation for PHP and UTF-8
Learn how MySQL character sets and collations work with PHP, and how to choose a practical UTF-8 setup for web applications.
Client-Side vs Server-Side Programming Explained with PHP and JavaScript
Learn the difference between client-side and server-side programming, why PHP cannot read JavaScript variables directly, and how data flows between browser and server.
Convert Date Formats in PHP: From yyyy-mm-dd to dd-mm-yyyy
Learn how to convert date formats in PHP using DateTime, strtotime, and date() with clear examples and common mistakes.
Convert a PHP Object to an Associative Array
Learn how to convert a PHP object to an associative array, including quick methods, recursion, pitfalls, and practical examples.
Convert a Postman Request to cURL and PHP cURL
Learn how to convert a Postman POST request into a cURL command and use the same request in PHP cURL with headers and body.
Converting HTML and CSS to PDF in PHP: Core Concepts, Limits, and Practical Approaches
Learn how HTML-to-PDF conversion works in PHP, why CSS support varies, and how to choose practical approaches for reliable PDF output.
Converting an Integer to a String in PHP
Learn how to convert an integer to a string in PHP using casting, interpolation, and functions with examples, mistakes, and practice.
Fixing dyld Library Not Loaded Errors for PHP on macOS Homebrew
Learn why PHP fails with a missing icu4c dylib after Homebrew installs and how to diagnose and fix broken dynamic library links on macOS.
Format Numbers to Two Decimal Places in PHP
Learn how to format a PHP string number to two decimal places using number_format, rounding, and safe numeric conversion.
HTTP_HOST vs SERVER_NAME in PHP: What’s the Difference?
Learn the difference between $_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME'] in PHP, when to use each, and common pitfalls.
How PHP foreach Actually Works with Arrays
Learn how PHP foreach works internally, including array copies, internal pointers, by-value vs by-reference behavior, and common pitfalls.
How to Add Elements to an Empty Array in PHP
Learn how to add values to an empty array in PHP using [] and array_push(), with examples, common mistakes, and real-world usage.
How to Add a New Column to an Existing Table in a Laravel Migration
Learn how to add a new column to an existing table in Laravel using migrations, Schema::table, and artisan commands.
How to Calculate the Difference Between Two Dates in PHP
Learn how to calculate the difference between two dates in PHP using DateTime and DateInterval, with examples and common mistakes.
How to Capture var_dump Output to a String in PHP
Learn how to capture var_dump output as a string in PHP using output buffering, with examples, pitfalls, and practical debugging use cases.
How to Change Maximum Upload File Size in PHP
Learn how PHP upload size limits work, which settings control them, and what to do when you cannot access php.ini or .htaccess.
How to Check If a String Is Valid JSON in PHP
Learn the correct and efficient way to check whether a string contains valid JSON in PHP using json_decode and json_last_error.
How to Check String Prefixes and Suffixes in PHP
Learn how to check whether a string starts or ends with specific text in PHP using simple functions and practical examples.
Page 1 of 6 - 112 questions