← 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
Copy-on-Write (CoW) in PHP Arrays PHP 7.0+
PHP arrays are not copied when assigned or passed to functions — they share the same internal buffer until one copy is modified. Only then does PHP perform a real copy. This makes reading large arrays cheap but silent mutations expensive.
2mo ago php intermediate
create_function() — The Dynamic Code Smell PHP 4.0+
create_function() created anonymous functions from strings — deprecated PHP 7.2, removed PHP 8. It used eval() internally, risked code injection, and was always replaceable with proper closures.
2mo ago php intermediate
Cross-Version Compatibility Testing PHP 7.0+
Testing PHP code across multiple versions uses CI matrix builds, phpenv/phpbrew, Docker multi-version setups, and static analysis to catch compatibility issues before deployment.
2mo ago php intermediate
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
callable vs Closure vs First-Class Callable PHP 7.1+
PHP has three callable forms: loose callable (string/array), typed Closure, and PHP 8.1 first-class callables (strlen(...)) — prefer Closure or first-class callables for type safety.
2mo ago php intermediate
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
Circular References & Memory Implications PHP 5.3+
Circular references between objects prevent PHP's reference counting GC from freeing memory — PHP's cycle collector handles them but with overhead.
2mo ago php intermediate
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
Constructor Promotion + readonly Together PHP 8.1+
PHP 8.1+ allows readonly in constructor promotion: public function __construct(public readonly string $name) — the cleanest way to write immutable value objects.
2mo ago php intermediate
Custom Error Handlers (set_error_handler) PHP 5.0+
set_error_handler() lets you replace PHP's default error handling with a custom callback — essential for logging, alerting, and graceful degradation.
2mo ago php intermediate
compact() & extract() — Variable Packing PHP 5.0+
compact() builds an array from named variables; extract() does the reverse — both are dangerous when used with user-controlled input.
CWE-473 OWASP A3:2021
2mo ago php beginner
Composer & Dependency Management PHP 5.3+
PHP's standard dependency manager; composer.json declares dependencies and composer.lock pins exact versions for reproducible builds.
2mo ago php beginner
Composer Scripts & Hooks PHP 5.3+
Composer's scripts section automates tasks triggered on lifecycle events (install, update) or run manually — cache clearing, migrations, asset builds.
2mo ago php intermediate
Constants (define vs const) PHP 5.0+
Named immutable values in PHP — const is compile-time and class-scoped; define() is runtime and supports dynamic names.
2mo ago php beginner
Constructor Property Promotion (PHP 8.0) PHP 8.0+
Declare and assign class properties directly in constructor parameters using visibility modifiers, eliminating boilerplate.
2mo ago php beginner
cURL in PHP PHP 5.0+
PHP's cURL extension enables making HTTP, FTP, and other protocol requests — the standard way to consume external APIs and services.
2mo ago php intermediate
Closures & Anonymous Functions PHP 5.3+
First-class anonymous functions that can capture variables from their enclosing scope via the use keyword.
2mo ago php intermediate
✓ schema.org compliant