Questions

PHP questions

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

PHP Syntax Symbols Explained: Operators, Tokens, and What They Mean

Learn what common PHP syntax symbols mean, including operators like ==, ===, ->, =>, ??, ?:, and more with clear examples.

phpargumentsoperatorssymbols

PHP Thread Safe vs Non-Thread Safe: What It Means and Which One to Use

Learn what thread-safe and non-thread-safe PHP builds mean, how they differ, and which PHP package to choose for Apache, FastCGI, and CLI use.

phpmultithreadingpackagethread-safety

PHP Variable to String: PHP Equivalent of Java/.NET ToString()

Learn how to convert PHP values to strings, when casting works, and how __toString() compares to Java and .NET ToString().

phpstring

PHP cURL Custom Headers: Sending HTTP Request Headers

Learn how to send custom HTTP headers with PHP cURL using CURLOPT_HTTPHEADER, including syntax, examples, debugging, and common mistakes.

phpcurl

PHP cURL HTTP POST Example: Sending Form Data and Reading the Response

Learn how to make an HTTP POST request with PHP cURL, send form data, and read the server response with clear examples.

phphttpcurlhttp-post

PHP define() vs const: Differences, Usage, and Best Practices

Learn the difference between define() and const in PHP, when to use each, and how constants behave in classes, files, and runtime code.

phpconstantspsr-1psr-12

PHP empty() and Method Return Values: Write Context Error Explained

Learn why older PHP versions reject empty() on method return values, what “write context” means, and safe alternatives for validation.

php

PHP json_decode(): Decode JSON as an Associative Array

Learn why json_decode returns stdClass objects by default in PHP and how to decode JSON into associative arrays safely and correctly.

phparraysjson

PHP new self vs new static: Understanding Late Static Binding

Learn the difference between `new self` and `new static` in PHP, including late static binding, inheritance behavior, and practical examples.

phpstaticlate-static-binding

PHP require vs include vs require_once vs include_once Explained

Learn the difference between require, include, require_once, and include_once in PHP, with examples, errors, and when to use each one.

phpincluderequirerequire-once

PHP self vs $this: Difference, Usage, and When to Use Each

Learn the difference between self and $this in PHP, when to use each, and how static vs instance context works with clear examples.

phpclassoopscope

PHP var Keyword: Class Properties in PHP 4 and PHP 5+

Learn what the PHP var keyword means, how it declares class properties, and the key differences between PHP 4 and modern PHP.

phpkeyword

PHPDoc Array of Objects Type Hints in PHP

Learn how to document arrays of objects in PHPDoc with SomeObj[], array<int, SomeObj>, iteration hints, typed properties, and common pitfalls.

phpidephpdocvar

PHP_EOL in PHP: Cross-Platform Line Endings Explained

Learn when to use PHP_EOL in PHP, how it handles Windows and Unix line endings, and when explicit \n or \r\n is required.

phpeol

Pretty-Printing JSON in PHP with json_encode

Learn how to pretty-print JSON in PHP using json_encode, including syntax, examples, common mistakes, and real-world usage.

phpjsonpretty-print

Public vs Private vs Protected in PHP Classes

Learn the difference between public, private, and protected in PHP classes, when to use each, and how visibility affects methods and properties.

phpoopprivatepublic

Python Equivalent of PHP var_dump(): repr, pprint, type, and vars

Learn Python alternatives to PHP var_dump(), including repr(), pprint(), type(), vars(), and inspect tools for clear debugging output.

phppythondebugging

Receive and Decode JSON POST Requests in PHP

Learn why PHP $_POST is empty for JSON requests, how to read php://input, decode JSON safely, validate errors, and handle payment webhooks.

phpjsonpost

Remove Non-Alphanumeric Characters in JavaScript

Learn how to remove non-alphanumeric characters from JavaScript strings with regular expressions while preserving letters, digits, and spaces.

phpregexstring

Render HTML Strings Safely in Laravel Blade

Learn why Blade escapes HTML by default, how to render trusted markup with {!! !!}, and how to prevent XSS in Laravel views.

phphtmllaravellaravel-blade

Page 7 of 9 - 162 questions