PHP match vs switch: which to use, and the loose comparison trap that catches people out
PHP match vs switch explained with tested examples: strict comparison, no fall-through, UnhandledMatchError, and match(true) for ranges.
Read postPractical ideas for small businesses: websites, booking, enquiries and keeping things easy to run.
PHP match vs switch explained with tested examples: strict comparison, no fall-through, UnhandledMatchError, and match(true) for ranges.
Read postHow PHP 8.3's json_validate() works, when it beats json_decode(), when it wastes a parse, and a tested JSON_THROW_ON_ERROR pattern for real input.
Read postPHP 8.4's array_find(), array_find_key(), array_any() and array_all() explained with tested examples, plus the null and empty-array gotchas.
Read postPHP 8.2 support ends 31 Dec 2026. Six deprecation warnings you'll likely meet on PHP 8.4 and 8.5, the exact messages, and the small fix for each.
Read postPHP backed enums explained: when from() throwing a ValueError is what you want, when tryFrom() and a default is safer, plus methods and cases().
Read postPHP 8.4's private(set) lets code read a property while only the class can change it. A worked invoice example, the rules, and when to pick readonly or hooks.
Read postPHP 8.4 property hooks put get and set logic on the property itself. How they work, a validation example, the gotchas, and when a plain method is still better.
Read postDateTime::modify() changes the object you call it on, so a start date can quietly move. When to use DateTimeImmutable, and how to switch over safely.
Read postHow PHP 8.5's #[\NoDiscard] attribute warns about ignored return values, what the (void) cast is for, where to use them, and how to stay compatible with 8.4.
Read postReplace md5/sha1 password storage with password_hash and password_verify. PASSWORD_DEFAULT, rehashing, and the habits that keep login code honest.
Read postHow PHP 8.5's array_first() and array_last() work, where they beat reset(), end() and [0], the null catch, and a safe fallback for PHP 8.4.
Read postPHP 8.5's built-in URI extension follows RFC 3986 and WHATWG. Why parse_url() warns you off, and when Uri\Rfc3986\Uri is the safer default.
Read postPHP 8.5's |> passes a value into the next single-arg callable. When pipe chains help business code, when named temps stay clearer, and the rules that matter.
Read postPHP 8.5 lets clone() take an array of property changes, so readonly with-er methods get shorter and safer. How it works, the rules and one gotcha.
Read postPHP Done The Correct Way (2nd edition) is out on Kindle and in paperback: modern PHP 8.5 for real sites, with free companion code on this site.
Read postPHP 8.2 stops getting security fixes on 31 December 2026. How to check which PHP your site runs, find the deprecation warnings and move up safely.
Read post