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.

phpsecuritypdosql-injection

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.

phparrayspdoprepared-statement

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.

phpmysqlencodingcollation

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.

phpjavascriptclient-sideserver-side

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.

phpdateformatting

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.

phparrays

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.

phpcurlpostman

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.

phphtmlcsspdf

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.

phpstringcastingtype-conversion

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.

phpnode.jsmacoshomebrew

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.

phpformattingnumbersrounding

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.

phpapacheserver-variables

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.

phploopsforeachiteration

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.

phparraysvariables

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.

phplaravellaravel-migrations

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.

phpdatetimedatediff

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.

phpstringvar-dump

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.

php

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.

phpjson

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.

phpstring

Page 1 of 6 - 112 questions

PreviousNext