Skip to content
Wade Womersley

wade.one

wade womersley – york based software engineer

  • Home
  • 2026
  • May
  • 9
  • PHP 8.5’s Pipe Operator Is for Readable Code, Not Clever Code

PHP 8.5’s Pipe Operator Is for Readable Code, Not Clever Code

Posted on May 9, 2026 By
PHP, Programming

The pipe operator in PHP 8.5 is going to be one of those features people either underuse or overuse. I like it, but only for the boring reason: it can make transformation code read in the order it actually happens. That is useful. Turning every function call into a pipeline because the syntax is new is not.

The PHP 8.5 release notes describe |> as a way to chain callables left-to-right, and the pipe operator RFC frames it as immediate function composition. The simple example is a slug pipeline: trim a string, replace spaces, strip punctuation, lower-case it. Written as nested calls, that kind of code reads inside-out. Written as a pipeline, it reads like a small recipe.

Where I would use it is in code that already has a clear sequence of transformations. Normalising imported data, preparing text, shaping API input, or passing a value through small named functions are all reasonable fits. Where I would avoid it is business logic with branching, side effects, unclear intermediate state, or callbacks that need long inline closures. At that point the pipe operator is not making the code clearer. It is just making the clever version shorter.

The best PHP features tend to work like this. They give you a cleaner expression for something you were already doing, but they do not remove the need to choose good boundaries. Used carefully, |> should make some code easier to scan in review. Used everywhere, it will just create a new style of unreadable PHP.

Share:

  • Share on Facebook (Opens in new window) Facebook
  • Share on X (Opens in new window) X
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Reddit (Opens in new window) Reddit

Related

Comments

comments

Tags: php php-8-5 pipe-operator refactoring

Post navigation

❮ Previous Post: PHP 8.5’s URI Extension Fixes a Real Web Problem
Next Post: PHP 8.5 Clone With Makes Value Objects Less Annoying ❯

You may also like

Ego-centric
Today’s musings
September 3, 2009
Programming
Using SSL in RestClient
March 4, 2011
Programming
Standardising logging and parallelisation in multiple languages
February 7, 2015
Programming
MySQL – Binary(16) and scalability
January 29, 2010
  • AI
  • artificial intelligence
  • Ego-centric
  • Events
  • Films
  • Food
  • Gaming
  • Gym
  • Hardware
  • Holidays
  • News
  • PHP
  • Programming
  • Random Stuff
  • Reviews
  • Science
  • SEO
  • Software
  • Software Engineer
  • Support
  • Uncategorized
  • Work

Copyright © 2026 wade.one.

Theme: Oceanly News Dark by ScriptsTown