A PHP RFC by Larry Garfield and Ilija Tovilo proposes an is operator for pattern matching. Expressions such as $value is int or a response matched against a status range return a boolean, while richer patterns can describe structure and extract values.
The appeal is readability around complex data. Existing PHP code often combines instanceof, isset, type checks, nested conditions, and manual assignment. Pattern matching lets the program state the accepted shape near the branch that uses it. Languages including Rust, Python, C#, Scala, and Swift offer related ideas, though their exact semantics differ.
The proposal belongs to a broader exploration of algebraic data types, tagged unions, value types, and destructuring in PHP. It has an implementation and detailed semantics, but it was still in discussion rather than voting at the article date. That status is the difference between a useful design signal and a feature teams can schedule.
Describe the shape at the branch
The operating gain shows up when the accepted shape sits next to the branch that uses it. Today an endpoint that receives a mixed array and a DTO runs instanceof, isset, is_int, array_key_exists, and manual assignments. The reader rebuilds the contract after eight lines. So does the author, six months later.
With $payload is ['user' => $user & AuthenticatedUser(role: 'admin'), ...], the contract fits in one expression. Binding happens only if the whole pattern matches. A pre-existing variable stays put on failure. That cuts a class of bug where the code extracts $id and only later learns that the rest was invalid.
Object patterns read properties accessible in scope. A get hook fires. An uninitialized property errors. __get enters the comparison. That matters for code with hooks and for incomplete ORM objects. A Point(x: 3, y: $y) pattern is not a silent isset.
Associative array patterns ignore key order and treat a missing key without an undefined warning, unlike $foo['c'] === 3. Positional patterns, in the implementation under discussion, behave close to sequential numeric keys; the authors still ask whether they should call array_is_list() internally, which has a cost. Anyone who compares arrays with === and depends on order needs to know the operator is not a synonym.
mixed works as a wildcard: the key or property must exist, the value can be anything. Useful for "this field arrived, I am not deciding the type yet". Literals, class constants, | unions and & intersections (in DNF, as with types) sit in the same system. Two patterns with binding cannot be ORed, because the variable would be undefined depending on the arm.
match() and the still-open questions
The RFC sketches two spellings for match(): match ($var) is { ... } applying a pattern on every arm, or is on each arm to mix equality and pattern. The authors are split. Ruby mixes less; most surveyed languages are always-pattern. That detail changes a team's style guide, so it is a poor idea to copy blog snippets as if they were the final grammar.
There is an implementation (php-src PR 20574) and a long semantics write-up. Wiki status: under discussion, not under vote. The version named in the text is PHP 8.6. Planning "when 8.6 ships, we rewrite the controllers" treats discussion as a release. 8.6 already carries other RFCs. This one can slip, shrink, or change match.
The new is conflicts with a global constant or a non-instance function named is (case insensitive: IS, Is). An inventory of function is( and define('IS' is worth more, today, than a syntax spike. It is the only announced BC break besides the obvious new keyword.
Compact ranges, regex, capturing the rest of an array after ..., and an optional-key marker sit in future scope. ADTs and enums with associated values are the stated horizon, with a positional slot reserved in the object syntax. None of those items belongs on the same Jira card as "study the operator".
A local experiment, off the release roadmap
The right place to play is an isolated module: HTTP response validation, config-array parsing, shape tests on fixtures. PHPUnit on the current version remains the pipeline contract. An engine fork or a mental polyfill does not go to production.
I would use the RFC as review vocabulary. "The shape here fits a pattern" is a useful comment even without the syntax. It pushes today's code toward early return and explicit extraction. When (and if) the operator exists, the translation becomes mechanical. Rewriting type-check helpers "to get ready" spends a sprint on a grammar that can still change match.
A stop rule for the experiment: if the isolated module is not more readable in the RFC's shape, the team does not have a use case, it has curiosity. Curiosity fits a brown-bag. It does not fit a version floor.
I also refuse to tie tagged unions, value types, and destructuring to the same investment. The RFC says matching is a stepping stone. Each stone will have its own vote. An architecture decision record can say "we follow rfc/pattern-matching; we do not pin a version". That is a decision. Reserving 8.7 on the roadmap because a post mentioned 2028 is something else.
What the proposal does not cover in business code
Validation that hits the database, an authorization policy, i18n, or a rule that does not express itself as a pattern stays outside. The operator does not replace a schema library or a form request. It compresses shape checks the program already does with instanceof and array_key_exists.
Code that already uses is as a name needs a rename before any adoption. Code that relied on a missing-key warning to "detect" a bad payload goes quiet on an associative pattern; absence becomes false from is, not a notice. That is an advantage in most controllers and a difference in scripts that treated the notice as a signal.
Until discussion turns into a vote, the team's decision is negative and cheap: do not reserve a sprint, do not pin a future version, do not promise ADTs in Q3. Reading the RFC still pays. It describes, with precision, the kind of data production PHP already tries to validate by hand. That map is useful today, in the review of a nested if, even if the operator takes a while.
If your company is weighing something similar, reach me on LinkedIn or WhatsApp.