← CodeClarityLab Home
Browse by Category
+ added · updated 7d
✕ Clear 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
each() & list() — Deprecated Iteration PHP 3.0+
each() was deprecated in PHP 7.2 and removed in PHP 8 — replace while(list($k,$v)=each($arr)) with foreach. list() itself is still valid as [] destructuring.
2mo ago php beginner
Engine Exceptions — Error Hierarchy (PHP 7.0) PHP 7.0+
PHP 7.0 made fatal engine errors catchable as Error subclasses — TypeError, ParseError, ArithmeticError, DivisionByZeroError — via the shared Throwable interface.
2mo ago php intermediate
Enums — First-Class Enumerations (PHP 8.1) PHP 8.1+
PHP 8.1 native enums replace class constant hacks — providing type-safe, enumerable, matchable values with optional backing values (: string or : int).
2mo ago php intermediate
ereg() / eregi() — POSIX Regex Removed in PHP 7 PHP 3.0+
ereg() and eregi() were POSIX regex functions removed in PHP 7.0 — replace with preg_match() (PCRE) which is faster, more powerful, and the standard since PHP 4.
2mo ago php beginner
Error Logging PHP 4.0+
Recording application errors, exceptions, and diagnostic information to persistent storage — essential for diagnosing production issues where display_errors must be off and errors are invisible to users.
2mo ago php beginner
Error Reporting & Display PHP 4.0+
PHP's error_reporting level and display_errors directive control which errors are shown and where — development needs E_ALL with display on; production needs E_ALL with display off and logging on.
2mo ago php beginner
Exception Handling Introduced (PHP 5) PHP 5.0+
PHP 5 introduced try/catch/finally and the Exception class — replacing PHP 4's procedural error handling with structured exception-based patterns.
2mo ago php beginner
Enum::cases() & Enum from()/tryFrom() PHP 8.1+
Backed enums provide from() (throws on miss) and tryFrom() (returns null) for value lookup, plus cases() to get all cases — essential for forms and validation.
2mo ago php intermediate
Enums Implementing Interfaces PHP 8.1+
PHP 8.1 enums can implement interfaces, allowing them to be used wherever an interface is expected — enabling polymorphic enum-based dispatch.
2mo ago php intermediate
Exception Hierarchy (Throwable, Error, Exception) PHP 7.0+
PHP 7+ unified exceptions and fatal errors under the Throwable interface — catch Throwable to handle both Error and Exception in one block.
2mo ago php intermediate
Enum Methods, Interfaces & Constants (PHP 8.1) PHP 8.1+
PHP 8.1 enums support methods, interface implementation, constants, and static factory methods — making them full-featured types, not just value lists.
2mo ago php intermediate
Enums (PHP 8.1) PHP 8.1+
Native enumerations providing type-safe named constants that replace class-constant patterns and stringly-typed values.
2mo ago php intermediate
Error Handling in PHP PHP 5.0+
Uncaught errors and verbose error output expose stack traces, file paths, and credentials to attackers.
CWE-209 OWASP A9:2021
2mo ago php beginner 5.3
escapeshellarg() PHP 5.0+
Wraps a string in single quotes and escapes internal quotes for safe use as a single shell argument.
2mo ago php intermediate
Exception Hierarchy & Custom Exceptions PHP 5.0+
Defining domain-specific exception classes that extend SPL exceptions provides semantic meaning and enables granular catch blocks.
2mo ago php intermediate
extract() — Dangerous Variable Injection PHP 4.0+
extract() creates local variables from an array, allowing attackers to overwrite existing variables if input is unsanitised.
CWE-621 OWASP A3:2021
2mo ago php beginner 9.8
Diagram: Exception Handling (try/catch/finally) Exception Handling (try/catch/finally) PHP 5.0+
PHP's structured error handling mechanism that separates error-path code from the happy path and ensures resource cleanup.
2mo ago php intermediate
✓ schema.org compliant