Questions

PHP questions

Choose a question page, learn the concept, then test your understanding with a quiz.

How to Delete an Element from an Array in PHP

Learn how to remove array elements in PHP using unset, array_filter, and reindexing, with examples and common mistakes explained clearly.

phparraysunset

How to Detect HTTP Request Methods in PHP (GET, POST, PUT, DELETE)

Learn how to detect GET, POST, PUT, and DELETE requests in PHP using REQUEST_METHOD, with examples, pitfalls, and real-world usage.

phphttprequest

How to Detect the First and Last Iteration in a foreach Loop in PHP

Learn how to detect the first and last iteration in a PHP foreach loop using counters, array keys, and practical beginner-friendly examples.

phploopsforeach

How to Display PHP Errors in the Browser

Learn how PHP error display works, why blank pages happen, and how to enable useful errors during development safely.

phperror-handlingsyntax-errorerror-reporting

How to Expire a PHP Session After 30 Minutes

Learn how to expire a PHP session after 30 minutes using inactivity timeouts, session checks, and safe logout logic in PHP.

phpsessioncookies

How to Find and Configure php.ini in PHP

Learn where php.ini is located, how PHP loads configuration files, and how to enable extensions like ibm_db2 safely and correctly.

phplinuxphp-ini

How to Find the Number of Days Between Two Dates in PHP

Learn how to calculate the number of days between two dates in PHP using DateTime, diff(), timestamps, and common best practices.

phpdatetime

How to Fix "Cannot Use Object of Type stdClass as Array" in PHP json_decode()

Learn why json_decode() returns stdClass objects in PHP and how to correctly access values as objects or associative arrays.

phpjson

How to Fix PHP Allowed Memory Size Exhausted Errors When Sending Large XML-RPC Payloads

Learn why PHP memory exhausted errors happen with large XML-RPC requests and how to reduce memory use in PHP and CodeIgniter apps.

phpmemorymemory-limit

How to Fix PHP Parse and Syntax Errors

Learn how to read PHP parse errors, find the real cause, and fix common syntax mistakes with practical examples and debugging steps.

phpparsingdebuggingsyntax-error

How to Fix the "Headers Already Sent" Error in PHP

Learn why PHP shows "Headers already sent" and how to fix it when using header() or setcookie() with clear examples.

phphttp-headers

How to Format Numbers with Leading Zeros in PHP

Learn how to add leading zeros in PHP using str_pad and sprintf, with examples, pitfalls, and real-world use cases.

phpnumbersformat

How to Get Raw SQL from Laravel Query Builder

Learn how to view the raw SQL generated by Laravel's query builder, including toSql(), bindings, and common debugging patterns.

phpsqllaraveleloquent

How to Get a File Extension in PHP

Learn the best way to get a file extension in PHP, including pathinfo(), edge cases, examples, and common mistakes beginners make.

phpfile-extension

How to Get a YouTube Video Thumbnail in PHP Using the YouTube API

Learn how to get a YouTube video thumbnail from a YouTube URL in PHP using the YouTube Data API and simple thumbnail URLs.

phpcurlyoutubeyoutube-api

How to Get the Client IP Address in PHP

Learn how to get a client IP address in PHP, when to use REMOTE_ADDR, and how to safely handle proxies and logging.

phpenvironment-variablesip-address

How to Get the Current Date and Time in PHP

Learn how to get the current date and time in PHP using date(), time(), and DateTime with clear examples and common mistakes.

phpdatetime

How to Get the Current Year in PHP for Dynamic Copyright Footers

Learn how to get the current year in PHP and use it in a dynamic copyright footer that updates automatically every year.

phpdate

How to Get the First Element of an Array in PHP

Learn how to get the first element of a PHP array without using array_shift or passing by reference, with examples and common pitfalls.

phparrays

How to Get the First Key of an Array in PHP

Learn how to get the first key of an array in PHP, including associative arrays, older approaches, and common mistakes to avoid.

phparrays

Page 3 of 7 - 136 questions