Tag: php
Iterating Objects with foreach (Iterator & IteratorAggregate)
PHP 5.5+
3
foreach can traverse any object implementing Iterator or IteratorAggregate, not just arrays — control iteration without exposing internal state.
1w ago
PHP intermediate
Regex Escape Sequences
PHP 4.1+
Backslash sequences in regex that either match special characters literally or represent character classes, anchors, and control characters.
3w ago
Regex intermediate
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
INSERT ... ON DUPLICATE KEY UPDATE
PHP 5.1+
An atomic MySQL upsert — inserts a new row or updates the existing one if a unique key constraint would be violated.
3mo ago
Database intermediate
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
A performance anti-pattern where fetching N records triggers N additional queries — one per record — instead of a single JOIN.
3mo ago
Database intermediate
PDO wraps multiple queries in an atomic unit — either all succeed or all roll back.
3mo ago
PHP intermediate
PDO::ATTR_EMULATE_PREPARES
PHP 5.1+
Controls whether PDO sends real prepared statements to the database or emulates them client-side in PHP.
CWE-89 OWASP A3:2021
3mo ago
PHP intermediate
PDOStatement::bindParam() vs bindValue()
PHP 5.1+
Two PDO methods for binding variables to placeholders — bindParam() binds by reference (evaluated at execute), bindValue() binds by value (evaluated immediately).
3mo ago
PHP intermediate
PHP Generators
PHP 5.5+
1
Functions using yield that produce values lazily — one at a time — instead of building a complete array in memory.
3mo ago
PHP intermediate
Test Doubles
PHP 8.0+
2
Substitute objects used in tests to replace real dependencies — mocks, stubs, spies, fakes, and dummies each serve a different purpose.
3mo ago
Testing intermediate
Type Inference
PHP 7.0+
4
The compiler's ability to automatically deduce the type of an expression without an explicit annotation, based on context and assigned values.
3mo ago
Compiler intermediate
Anonymous Functions / Closures (PHP 5.3)
PHP 5.3+
1
PHP 5.3 introduced anonymous functions (closures) — function() {} expressions assignable to variables, passable as callbacks, and able to capture outer scope with use().
3mo ago
PHP intermediate
APM — Application Performance Monitoring
PHP 7.0+
1
APM tools (Datadog, New Relic, Blackfire) automatically instrument applications to profile code-level performance — identifying slow DB queries, N+1 problems, and method-level bottlenecks.
3mo ago
Observability intermediate
array_map / filter / reduce as FP Patterns
PHP 5.3+
1
PHP's array_map(), array_filter(), and array_reduce() enable functional-style data transformation pipelines — cleaner than imperative loops for many common patterns.
3mo ago
PHP intermediate
Attributes #[] Replacing Docblock Annotations
PHP 8.0+
PHP 8.0 native attributes (#[Route('/home')]) replace fragile DocBlock @annotations — they're syntactically valid, parseable without reflection hacks, and supported by IDEs and static analysis.
3mo ago
PHP intermediate
Authentication
PHP 7.0+
8
The process of verifying that a user is who they claim to be — typically by validating credentials (password, token, certificate) and establishing a session or issuing a signed token for subsequent requests.
3mo ago
Security intermediate
Authorisation
PHP 7.0+
3
The process of determining what an authenticated user is permitted to do — checking permissions, roles, or policies before allowing access to a resource or action.
3mo ago
Security intermediate
Caching Strategies
PHP 7.0+
Patterns for when and how to store and invalidate cached data — cache-aside, write-through, write-behind, and read-through each make different trade-offs between consistency, complexity, and performance.
3mo ago
Performance intermediate
Cardinality in Observability
PHP 7.0+
The number of unique combinations of label values in a metric — high cardinality (millions of unique label combinations) causes memory exhaustion in time-series databases and is the most common observability scaling problem.
3mo ago
Observability intermediate