Tag: php
PDO Error Handling
PHP 5.1+
PDO has three error modes — silent, warning, and exception — controlling how database errors surface.
3mo ago
PHP beginner
PDO Fetch Modes
PHP 5.1+
Constants controlling how PDO returns rows — as arrays, objects, or custom classes.
3mo ago
PHP beginner
PDO lastInsertId()
PHP 5.1+
Returns the auto-increment ID generated by the most recent INSERT statement.
3mo ago
PHP beginner
PDO Named Placeholders
PHP 5.1+
Named parameters (:name) in prepared statements — more readable than positional ? placeholders for queries with multiple parameters.
3mo ago
PHP beginner
PDO query() vs prepare()
PHP 5.1+
PDO query() executes raw SQL immediately — prepare() parameterises it. query() must never include user-controlled values.
CWE-89 OWASP A3:2021
3mo ago
PHP beginner
9.8
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
PDOStatement::rowCount()
PHP 5.1+
Returns the number of rows affected by the last DELETE, INSERT, or UPDATE — unreliable for SELECT.
3mo ago
PHP beginner
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
How PHP Fibers work under the hood — stack allocation, suspension mechanics, and how to build a cooperative multitasking scheduler on top of the Fiber API introduced in PHP 8.1.
3mo ago
PHP advanced
password_hash() — Native Bcrypt (PHP 5.5)
PHP 5.5+
PHP 5.5 added password_hash() and password_verify() — the only correct way to hash and verify passwords. Never use MD5, SHA1, or unsalted hashes.
3mo ago
PHP beginner
PCNTL Signals in CLI PHP
PHP 7.1+
7
The PCNTL extension lets CLI PHP scripts handle OS signals (SIGTERM, SIGINT, SIGUSR1) — enabling graceful shutdown and hot reload in long-running daemons.
3mo ago
PHP advanced
PHP 3 — Birth of the Language (Rasmus Lerdorf)
PHP 3.0+
1
PHP 3 (1997) was the first version called 'PHP' — a complete rewrite by Zeev Suraski and Andi Gutmans that transformed Rasmus Lerdorf's Personal Home Page tools into a proper language.
3mo ago
PHP beginner
PHP 4 Objects Passed by Value (Pre-5 Gotcha)
PHP 4.0+
1
PHP 4 copied objects on assignment — $b = $a created a full clone. PHP 5+ passes object handles by value (reference semantics). This was the biggest PHP 4 pain point.
3mo ago
PHP intermediate
PHP 4 — Zend Engine 1, Classes Without OOP
PHP 4.0+
3
PHP 4 (2000) introduced the Zend Engine 1.0 — dramatically improving performance and adding basic classes, though objects were passed by value and OOP was rudimentary.
3mo ago
PHP beginner
PHP 8 — Key Features
PHP 8.0+
PHP 8.0–8.4 introduced match expressions, named arguments, union types, nullsafe operator, fibers, enums, readonly properties, first-class callables, and a JIT compiler — the most significant evolution of the language since PHP 5.
3mo ago
PHP intermediate
PHP Mail & SMTP
PHP 4.0+
Sending email from PHP using mail(), SMTP libraries like PHPMailer or Symfony Mailer, or transactional email APIs — with critical configuration for deliverability, security, and reliability.
3mo ago
PHP beginner
PHP SAPI Types (FPM, CLI, Embed)
PHP 4.0+
SAPI (Server API) defines how PHP is invoked — php-fpm for web requests, php-cli for commands, embed for C extensions — each has different lifecycle and configuration.
3mo ago
PHP intermediate
PHP Sessions
PHP 4.0+
1
Server-side state storage identified by a cookie-based session ID — PHP's built-in mechanism for persisting data across HTTP requests, with security implications for how the session is started, stored, and terminated.
3mo ago
PHP beginner