← CodeClarityLab Home
Browse by Category
+ added · updated 7d
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Short Open Tags History & Why to Avoid PHP 3.0+
PHP's short tags (<? ?> and <?= ?>) have been problematic since PHP 3 — disabled by many hosting providers, conflicting with XML, and inconsistent across environments.
2mo ago php beginner
SimpleXML — Parsing XML in PHP PHP 5.0+
SimpleXML provides the fastest way to read well-formed XML in PHP — simplexml_load_string() or simplexml_load_file() returns an object where elements are properties and attributes are array-accessed, requiring no tree traversal.
2mo ago php beginner
Spread Operator & Variadic Args (PHP 5.6) PHP 5.6+
PHP 5.6 added variadic functions (...$args) and argument unpacking ($array...) — replacing func_get_args() and call_user_func_array() with clean syntax.
2mo ago php beginner
sprintf() — Format Strings in PHP PHP 4.0+
sprintf() builds a string by substituting typed placeholders (%s, %d, %f, %05d) with values — safer and more expressive than string concatenation or interpolation for formatted output, especially for numbers, padding, and locale-independent formatting.
2mo ago php beginner
ArgumentCountError — Wrong Arg Count PHP 7.1+
PHP 7.1+ throws ArgumentCountError when too few arguments are passed to a function — too many arguments are silently ignored (unless using strict_types).
2mo ago php beginner
Call to Undefined Function/Method PHP 4.0+
'Call to undefined function' means the function wasn't declared, the file wasn't loaded, or the PHP extension providing it isn't installed.
2mo ago php beginner
Cannot Redeclare Function/Class Errors PHP 4.0+
PHP throws a fatal error when a function or class is declared twice in the same request — use autoloading and function_exists() guards to prevent it.
2mo ago php beginner
Class Not Found / Autoloader Failures PHP 5.3+
'Class not found' errors mean the autoloader couldn't locate the class file — usually a namespace mismatch, missing composer install, or PSR-4 misconfiguration.
2mo ago php beginner
Division by Zero & DivisionByZeroError PHP 7.0+
PHP 7+ throws DivisionByZeroError for intdiv() and modulo with zero — but the / operator returns false or INF instead of throwing.
2mo ago php beginner
Fatal Errors vs Errors vs Warnings PHP 5.0+
PHP has three error levels that behave very differently: fatal errors halt execution, warnings continue but signal problems, and notices are advisory only.
2mo ago php beginner
Headers Already Sent Error PHP 5.0+
PHP sends HTTP headers on first output — any echo, whitespace, or BOM before header() causes 'Cannot modify header information — headers already sent'.
2mo ago php beginner
Magic Quotes — What They Were and Why Removed PHP 3.0+
Magic quotes automatically escaped incoming data with addslashes() in PHP 3/4/5 — removed in PHP 5.4 because it caused more problems than it solved and gave developers false SQL injection protection.
2mo ago php beginner
max_execution_time & set_time_limit() PHP 4.0+
max_execution_time limits script CPU time (not wall-clock time) — use set_time_limit(0) sparingly for long-running CLI tasks, never for web requests.
2mo ago php beginner
mysql_* Functions — Why They Were Removed PHP 3.0+
The original mysql_* extension was removed in PHP 7.0 after years of deprecation — it lacked prepared statements, making parameterised queries impossible and SQL injection trivially easy.
2mo ago php beginner
Namespaces Introduced in PHP 5.3 PHP 5.3+
PHP 5.3 (2009) introduced namespaces with the namespace keyword and backslash separator — enabling PSR-4 autoloading and modern package management with Composer.
2mo ago php beginner
Parse Errors & Syntax Debugging PHP 5.0+
A ParseError (E_PARSE) means PHP cannot tokenise your file — the script never runs. Common causes: missing semicolons, unclosed brackets, and typos.
2mo ago php beginner
PDO Introduction — Replacing mysql_* with Prepared Statements PHP 5.1+
PDO (PHP Data Objects), introduced in PHP 5.1, provided a unified database abstraction layer with named parameters and prepared statements — finally making SQL injection prevention structurally reliable.
2mo ago php beginner
PHP End-of-Life Schedule & Security Implications PHP 5.0+
Each PHP minor version receives active support for 2 years and security-only fixes for 1 more year — running an EOL PHP version means no patches for discovered vulnerabilities.
2mo ago php beginner
Spaceship Operator <=> (PHP 7.0) PHP 7.0+
The spaceship operator <=> returns -1, 0, or 1 by comparing two values — it replaces verbose if/else comparison callbacks in usort() with a single concise expression.
2mo ago php beginner
Spread Operator in Arrays [...$a, ...$b] PHP 8.1+
PHP 8.1+ allows the spread operator ... inside array literals to merge arrays — cleaner than array_merge() for combining arrays inline.
2mo ago php beginner
✓ schema.org compliant