Questions

PHP questions

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

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

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 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

How to Check if a String Contains a Word in PHP

Learn how to check whether a PHP string contains a specific word using strpos and str_contains with clear examples and common mistakes.

phpstringsubstringcontains

How to Delete an Array Element by Value in PHP

Learn how to remove an array element by value in PHP using array_search and unset, with examples, pitfalls, and practical patterns.

phparrays

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 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 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 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 Hash Passwords with bcrypt in PHP

Learn what bcrypt is in PHP, how password_hash and password_verify work, and the correct way to store passwords securely.

phppasswordscryptographypassword-protection

How to Parse and Process HTML/XML in PHP

Learn how to parse HTML and XML in PHP using DOMDocument, XPath, and SimpleXML to extract data safely and clearly.

phphtmlxmlxml-parsing

How to Prevent SQL Injection in PHP

Learn how to prevent SQL injection in PHP using prepared statements, parameter binding, input validation, and safe database APIs.

phpmysqlsqlsecurity

How to Redirect in PHP with the header() Function

Learn how to redirect users in PHP using header(), including syntax, login protection, common mistakes, and real examples.

phphttp-redirecthttp-status-code-301

How to Return JSON from a PHP Script

Learn how to return JSON from PHP correctly using json_encode, proper headers, and practical examples for APIs and AJAX responses.

phpjsonheader

How to Sanitize User Input in PHP for SQL Injection and XSS

Learn how to sanitize and validate user input in PHP to prevent SQL injection and XSS while safely allowing selected HTML tags.

phpsecurityxsssql-injection

How to Set Up UTF-8 End to End in PHP, MySQL, and Apache

Learn how to configure UTF-8 correctly across PHP, MySQL, Apache, HTML, and databases to avoid charset mismatches in web apps.

phpmysqlapacheutf-8

Page 1 of 2 - 32 questions

PreviousNext