Tag: php
Memory Pressure Detection
PHP 7.0+
Proactively identifying when a PHP process approaches its memory limit so corrective action can be taken before a fatal error.
2mo ago
Performance intermediate
Mutex vs Semaphore
PHP 7.0+
1
A mutex allows only one thread to access a resource at a time — a semaphore controls access to a pool of N identical resources.
CWE-362
3mo ago
Concurrency advanced
MySQL charset=utf8mb4
PHP 5.1+
The correct MySQL character set for full Unicode support — including emoji and supplementary characters that the older utf8 charset cannot store.
3mo ago
PHP beginner
MySQL Connection Pooling
PHP 5.1+
1
Reusing database connections across requests instead of opening and closing a new connection on every request.
3mo ago
PHP intermediate
MySQL DSN (Data Source Name)
PHP 5.1+
The connection string passed to PDO specifying the database driver, host, port, database name, and charset.
3mo ago
PHP beginner
match Expression (PHP 8.0)
PHP 8.0+
PHP 8.0's match is a stricter switch — uses strict (===) comparison, each arm is an expression (not statements), returns a value, and throws UnhandledMatchError if no arm matches.
3mo ago
PHP beginner
mcrypt Deprecation — Migrate to OpenSSL
PHP 5.0+
mcrypt was deprecated in PHP 7.1 and removed in PHP 7.2 — migrate all encryption to OpenSSL (openssl_encrypt) or libsodium (sodium_crypto_secretbox).
3mo ago
PHP intermediate
Memory Exhaustion
PHP 4.0+
1
PHP's Allowed Memory Size Exhausted fatal error — caused by loading too much data into memory at once, unbounded loops accumulating objects, or memory leaks in long-running processes.
3mo ago
PHP intermediate
Migrating from PHP 4 to PHP 5
PHP 4.0+
PHP 4→5 migration: objects now pass by reference, add visibility (public/protected/private), replace var with typed properties, fix object assignment semantics, and adopt try/catch.
3mo ago
PHP intermediate
Migrating from PHP 7 to PHP 8
PHP 7.0+
PHP 7→8 migration: fix type coercion changes (stricter), remove deprecated functions (each(), create_function()), update match/constructor promotion, check third-party compatibility.
3mo ago
PHP intermediate
MVC Pattern
PHP 5.0+
Model-View-Controller — an architectural pattern separating data (Model), presentation (View), and request handling (Controller), the foundation of Laravel, Symfony, and most PHP frameworks.
3mo ago
Architecture beginner
match() Default Arm vs No Default
PHP 8.0+
match() without a default arm throws UnhandledMatchError if no arm matches — unlike switch, which silently falls through.
3mo ago
PHP intermediate
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.
3mo ago
PHP beginner
Meilisearch & Typesense
PHP 7.0+
1
Open-source, self-hosted search engines with PHP SDKs — fast BM25 search, typo-tolerance, and faceting without the operational complexity of Elasticsearch.
3mo ago
Search intermediate
Memory Management — Stack vs Heap
PHP 5.0+
2
The stack holds function call frames with fixed-size local variables — fast, automatic, limited. The heap holds dynamically allocated objects — flexible, managed by GC, slower.
3mo ago
Compiler intermediate
MIME Sniffing & X-Content-Type-Options
PHP 5.0+
Browsers that sniff file content to guess MIME type can execute uploaded HTML/JavaScript files as scripts — X-Content-Type-Options: nosniff prevents this.
3mo ago
Security intermediate
Missing Class Comments
PHP 5.0+
A class without a PHPDoc block lacks the docblock description, @package annotation, and context needed for IDE tooling, generated documentation, and new developers.
3mo ago
Style beginner
Missing CSRF Protection
PHP 5.0+
A state-changing form or endpoint that lacks a CSRF token allows attackers to forge authenticated requests from any website the victim visits.
3mo ago
Security intermediate
Missing Function Comments
PHP 5.0+
Functions without PHPDoc lose IDE parameter hints, inline documentation, and the opportunity to explain non-obvious behaviour, preconditions, and edge cases.
3mo ago
Style beginner
Missing Return Type Declarations
PHP 7.0+
Functions without declared return types lose static analysis coverage, allow type confusion bugs, and make code harder to understand without reading the implementation.
3mo ago
Code Quality beginner