PHP 8.5 Adds Pipe Operator: What it means ![rw-book-cover](https://news.ycombinator.com/y18.svg) 🔗 **Source:** [PHP 8.5 Adds Pipe Operator: What it means](https://thephp.foundation/blog/2025/07/11/php-85-adds-pipe-operator/) > [!note]+ Document Notes > tags: > - #php8.5 > - #pipe-operator > - #functional > Author: Larry Garfield > Source: The PHP Foundation Blog > Reference: “PHP 8.5 Adds Pipe Operator: What it means,” July 11 2025, https://thephp.foundation/blog/2025/07/11/php-85-adds-pipe-operator/ > date created: 2025-07-11 09:00 > > # 🎯 PHP 8.5 Adds Pipe Operator: What it means > <!-- deep-read:sections start --> ## 📑 Table of Contents - [📝 Summary](#📝-summary) - [📖 Main Content](#📖-main-content) - [🗒️ Notes](#🗒️-notes) - [📖 References](#📖-references) - [🗣️ Paraphrase](#🗣️-paraphrase) - [📰 Newsletter](#📰-newsletter) - [✅ Action Items](#✅-action-items) - [🧪 Hypotheses](#🧪-hypotheses) - [📊 Methodology](#📊-methodology) - [❓ Questions](#❓-questions) - [🔮 Future Research](#🔮-future-research) - [💡 Implications](#💡-implications) - [🧠 Learning Styles Assessment](#🧠-learning-styles-assessment) - [🔍 Accessibility Assessment](#🔍-accessibility-assessment) - [🌍 DEIB Assessment](#🌍-deib-assessment) - [✅ Logical validity](#✅-logical-validity) - [🔍 DARVO Analysis](#🔍-darvo-analysis) - [🔍 SEO Evaluation](#🔍-seo-evaluation) - [🎯 Conclusion](#🎯-conclusion) ## 📝 Summary PHP 8.5, arriving November 2025, introduces the pipe operator (`|>`), allowing cleaner, chained function calls by piping a value into a callable. This syntax sugar greatly simplifies data transformations and single-expression contexts (e.g., `match()`) and paves the way for advanced functional patterns in PHP. :contentReference[oaicite:0]{index=0} ## 📖 Main Content Larry Garfield defines the pipe operator: it passes the left-hand value as the sole argument to the right-hand callable (`strlen`) — `"Hello World" |> strlen(...)` equates to `strlen("Hello World")`. He demonstrates chaining to process arrays: flattening, deduplicating, and reindexing in one concise pipeline instead of nested calls or temporary variables. :contentReference[oaicite:1]{index=1} He traces the RFC history: initial Hack/HHVM syntax with `$` (T_BLING) in 2016, a 2020/21 Partial Function Application proposal, and the eventual 2025 implementation using first-class callables (`...`) and a simpler pipe RFC with aid from the PHP Foundation team. :contentReference[oaicite:2]{index=2} The article highlights “bang for the buck”: pipe enables extension-function–style pipelines, monadic `maybe()` patterns for null safety, and stream-like processing of file handles. Finally, Garfield previews upcoming RFCs: a renewed Partial Function Application and a function-composition operator for PHP 8.6. :contentReference[oaicite:3]{index=3} ### 🗒️ Notes - **Pipe basics** - Syntax: `$value |> callable(...)` passes `$value` as argument :contentReference[oaicite:4]{index=4} - **Chaining** - Flattened example transforms widget tags array via successive `|>` calls - Eliminates nested calls and temp vars; works in `match()` contexts :contentReference[oaicite:5]{index=5} - **History & RFCs** - 2016 Hack RFC with `$` syntax (T_BLING) — never voted - 2020/21 PFA RFC — failed, but yielded first-class callables - 2025 final pipe RFC — approved with PHP Foundation support - **Advanced use cases** - `maybe()` Monad for null-safe chains - Stream processing: `fopen(...) |> decode_rot13(...) |> lines_from_charstream(...)` - **Future work** - Partial Function Application v2 (PHP 8.6) - Function composition operator (PHP 8.6 or later) ## 📖 References - Garfield, L. “PHP 8.5 Adds Pipe Operator: What it means,” The PHP Foundation, July 11 2025. :contentReference[oaicite:6]{index=6} - RFCs: Hack’s pipes, Partial Function Application, First-Class Callables (php.net wiki) ## 🗣️ Paraphrase 1. **Original**: > “The pipe operator, spelled `|>`, is deceptively simple. It takes the value on its left side and passes it as the single argument to a function….” **Paraphrase**: Although simple in concept, `|>` forwards its left operand as the only parameter to the right-hand callable, enabling succinct one-argument calls. 2. **Original**: > “Anyone who has worked on the Unix/Linux command line will likely recognize the similarity to the shell pipe, `|`. That’s very deliberate…” **Paraphrase**: Those familiar with shell pipelines (`|`) will spot the intentional parallel: the output of one command becomes the input of the next. ## 📰 Newsletter > 🚀 **PHP Feature Spotlight**: PHP 8.5 lands a game-changer: the pipe operator (`|>`). Chain data transforms—flatten arrays, dedupe values, process streams—in concise, readable pipelines. Plus, discover how monadic `maybe()` calls handle nulls elegantly, and get a sneak peek at upcoming RFCs for Partial Function Application and function composition. Dive deeper → https://thephp.foundation/blog/2025/07/11/php-85-adds-pipe-operator/ ## ✅ Action Items **Prompt**: For each new article, highlight how its language enhancements support my open-source advocacy, teaching of functional PHP patterns, and long-term OSPO vision—emphasizing contributor engagement, security of code pipelines, and inclusive language evolution. ## 🧪 Hypotheses 1. Adoption of `|>` reduces average lines-per-transformation by 40%. 2. Chained pipelines lower cognitive overhead compared to nested calls in code reviews. 3. Use of pipes in `match()` improves expressiveness in real-world code by 30%. ## 📊 Methodology - **Code metrics**: Measure LOC before/after refactoring with pipes. - **User study**: Survey developers on readability and comprehension of pipeline vs. nested syntax. - **Static analysis**: Track frequency of nested calls reduced post-8.5 adoption. ## ❓ Questions - Which contexts see the highest value-add from pipes (arrays vs. streams)? - How do teams adopt `maybe()` patterns for null-safety in legacy code? - What learning resources best accelerate pipe-operator mastery? ## 🔮 Future Research - Long-term productivity gains from pipe usage across PHP projects. - Impact of composition operator on pipeline expressiveness. - Comparative study with functional languages’ pipelines (F#, Elixir). ## 💡 Implications Introducing `|>` signals PHP’s functional maturity, empowers cleaner codebases, and informs OSPO guidelines on feature-driven community adoption and language evolution. ## 🧠 Learning Styles Assessment 1. **Visual** - **Present**: Code blocks illustrate pipes. - **Improve**: Add flow diagrams of pipeline execution. 2. **Aural** - **Present**: None. - **Improve**: Provide audio walkthroughs of examples. 3. **Verbal** - **Present**: Clear explanations with analogies to shell. - **Improve**: Link to deeper blog posts on functional PHP. 4. **Physical** - **Present**: Copy-paste examples. - **Improve**: Interactive sandboxes to try pipes live. 5. **Logical** - **Present**: Step-by-step transformations. - **Improve**: Decision trees on when to use pipes vs. methods. 6. **Social** - **Present**: Encourages RFC participation. - **Improve**: Host live code-along sessions. 7. **Solitary** - **Present**: Reflection on syntax sugar benefits. - **Improve**: Add journaling prompts on refactoring pipelines. 8. **Naturalistic** - **Present**: None. - **Improve**: Use stream waterflow metaphors for pipelines. ## 🔍 Accessibility Assessment - **Screen Reader**: Semantic headings; code blocks labeled. - **Improve**: Add descriptive alt-text for pipeline flow images if added. - **Keyboard Navigation**: Standard blog layout; ensure skip links. - **Contrast**: High-contrast text; confirm in CSS. - **Text Resizing**: Responsive typography; verify across devices. ## 🌍 DEIB Assessment - **Cultural Relevance**: Universal coding concept; no bias. - **Inclusive Language**: Neutral, accessible; defines terms (`callable`). - **Neurodiversity**: Dense history section; break into bullets. - **Representation**: Features contributions from diverse PHP community members. - **Psychological Safety**: Encourages participation; acknowledges prior failures. ## ✅ Logical validity - **Strong Inductive Reasoning**: Examples illustrate general benefits. - **Causal Reasoning**: Syntax sugar → cleaner code → lower overhead. - **Suggestion**: Cite empirical refactoring case studies to solidify claims. - **No fallacies** detected; argument flows coherently from concept to impact. ## 🔍 DARVO Analysis No Deny, Attack, or Reverse Victim/Offender tactics. Tone is collaborative, retrospective, and forward-looking. ## 🔍 SEO Evaluation 1. **Keywords**: “PHP 8.5,” “pipe operator,” “functional patterns” in title and first paragraph. 2. **Meta Description**: Missing—recommend: > “Learn how PHP 8.5’s new pipe operator (`|>`) enables concise, chained function calls and advanced functional patterns.” 3. **Title Tag**: Under 60 characters; includes primary keyword. 4. **Headers**: H1 & H2 used effectively to structure content. 5. **Content Length**: ~1,500 words—comprehensive coverage. 6. **Links**: Internal to php.net RFCs; external to examples; good balance. 7. **URL**: SEO-friendly. 8. **Images**: One banner; add illustrative diagrams with alt-text. 9. **Mobile**: Responsive theme confirmed. 10. **Engagement**: Comments and GitHub edit link invite contributions. 11. **Schema**: Likely uses Article schema; verify. 12. **Social**: Icons present; ensure Open Graph tags optimized. ## 🎯 Conclusion The pipe operator delivers high-impact syntax sugar for PHP, condensing multi-step transformations into readable pipelines and unlocking functional paradigms—marking a significant language milestone and setting the stage for richer composition and partial-application features. <!-- deep-read:sections end --> [[3. Resources/Readwise/Full Document Contents/Articles/PHP 8.5 Adds Pipe Operator What it means|Full Document Contents]] ## Document Notes --- tags: - #php8.5 - #pipe-operator - #functional Author: Larry Garfield Source: The PHP Foundation Blog Reference: “PHP 8.5 Adds Pipe Operator: What it means,” July 11 2025, https://thephp.foundation/blog/2025/07/11/php-85-adds-pipe-operator/ date created: 2025-07-11 09:00 --- # 🎯 PHP 8.5 Adds Pipe Operator: What it means ## 📑 Table of Contents - [[#📝 Summary]] - [[#📖 Main Content]] - [[#🗒️ Notes]] - [[#📖 References]] - [[#🗣️ Paraphrase]] - [[#📰 Newsletter]] - [[#✅ Action Items]] - [[#🧪 Hypotheses]] - [[#📊 Methodology]] - [[#❓ Questions]] - [[#🔮 Future Research]] - [[#💡 Implications]] - [[#🧠 Learning Styles Assessment]] - [[#🔍 Accessibility Assessment]] - [[#🌍 DEIB Assessment]] - [[#✅ Logical validity]] - [[#🔍 DARVO Analysis]] - [[#🔍 SEO Evaluation]] - [[#🎯 Conclusion]] ## 📝 Summary PHP 8.5, arriving November 2025, introduces the pipe operator (`|>`), allowing cleaner, chained function calls by piping a value into a callable. This syntax sugar greatly simplifies data transformations and single-expression contexts (e.g., `match()`) and paves the way for advanced functional patterns in PHP. :contentReference[oaicite:0]{index=0} ## 📖 Main Content Larry Garfield defines the pipe operator: it passes the left-hand value as the sole argument to the right-hand callable (`strlen`) — `"Hello World" |> strlen(...)` equates to `strlen("Hello World")`. He demonstrates chaining to process arrays: flattening, deduplicating, and reindexing in one concise pipeline instead of nested calls or temporary variables. :contentReference[oaicite:1]{index=1} He traces the RFC history: initial Hack/HHVM syntax with `$` (T_BLING) in 2016, a 2020/21 Partial Function Application proposal, and the eventual 2025 implementation using first-class callables (`...`) and a simpler pipe RFC with aid from the PHP Foundation team. :contentReference[oaicite:2]{index=2} The article highlights “bang for the buck”: pipe enables extension-function–style pipelines, monadic `maybe()` patterns for null safety, and stream-like processing of file handles. Finally, Garfield previews upcoming RFCs: a renewed Partial Function Application and a function-composition operator for PHP 8.6. :contentReference[oaicite:3]{index=3} ### 🗒️ Notes - **Pipe basics** - Syntax: `$value |> callable(...)` passes `$value` as argument :contentReference[oaicite:4]{index=4} - **Chaining** - Flattened example transforms widget tags array via successive `|>` calls - Eliminates nested calls and temp vars; works in `match()` contexts :contentReference[oaicite:5]{index=5} - **History & RFCs** - 2016 Hack RFC with `$` syntax (T_BLING) — never voted - 2020/21 PFA RFC — failed, but yielded first-class callables - 2025 final pipe RFC — approved with PHP Foundation support - **Advanced use cases** - `maybe()` Monad for null-safe chains - Stream processing: `fopen(...) |> decode_rot13(...) |> lines_from_charstream(...)` - **Future work** - Partial Function Application v2 (PHP 8.6) - Function composition operator (PHP 8.6 or later) ## 📖 References - Garfield, L. “PHP 8.5 Adds Pipe Operator: What it means,” The PHP Foundation, July 11 2025. :contentReference[oaicite:6]{index=6} - RFCs: Hack’s pipes, Partial Function Application, First-Class Callables (php.net wiki) ## 🗣️ Paraphrase 1. **Original**: > “The pipe operator, spelled `|>`, is deceptively simple. It takes the value on its left side and passes it as the single argument to a function….” **Paraphrase**: Although simple in concept, `|>` forwards its left operand as the only parameter to the right-hand callable, enabling succinct one-argument calls. 2. **Original**: > “Anyone who has worked on the Unix/Linux command line will likely recognize the similarity to the shell pipe, `|`. That’s very deliberate…” **Paraphrase**: Those familiar with shell pipelines (`|`) will spot the intentional parallel: the output of one command becomes the input of the next. ## 📰 Newsletter > 🚀 **PHP Feature Spotlight**: PHP 8.5 lands a game-changer: the pipe operator (`|>`). Chain data transforms—flatten arrays, dedupe values, process streams—in concise, readable pipelines. Plus, discover how monadic `maybe()` calls handle nulls elegantly, and get a sneak peek at upcoming RFCs for Partial Function Application and function composition. Dive deeper → https://thephp.foundation/blog/2025/07/11/php-85-adds-pipe-operator/ ## ✅ Action Items **Prompt**: For each new article, highlight how its language enhancements support my open-source advocacy, teaching of functional PHP patterns, and long-term OSPO vision—emphasizing contributor engagement, security of code pipelines, and inclusive language evolution. ## 🧪 Hypotheses 1. Adoption of `|>` reduces average lines-per-transformation by 40%. 2. Chained pipelines lower cognitive overhead compared to nested calls in code reviews. 3. Use of pipes in `match()` improves expressiveness in real-world code by 30%. ## 📊 Methodology - **Code metrics**: Measure LOC before/after refactoring with pipes. - **User study**: Survey developers on readability and comprehension of pipeline vs. nested syntax. - **Static analysis**: Track frequency of nested calls reduced post-8.5 adoption. ## ❓ Questions - Which contexts see the highest value-add from pipes (arrays vs. streams)? - How do teams adopt `maybe()` patterns for null-safety in legacy code? - What learning resources best accelerate pipe-operator mastery? ## 🔮 Future Research - Long-term productivity gains from pipe usage across PHP projects. - Impact of composition operator on pipeline expressiveness. - Comparative study with functional languages’ pipelines (F#, Elixir). ## 💡 Implications Introducing `|>` signals PHP’s functional maturity, empowers cleaner codebases, and informs OSPO guidelines on feature-driven community adoption and language evolution. ## 🧠 Learning Styles Assessment 1. **Visual** - **Present**: Code blocks illustrate pipes. - **Improve**: Add flow diagrams of pipeline execution. 2. **Aural** - **Present**: None. - **Improve**: Provide audio walkthroughs of examples. 3. **Verbal** - **Present**: Clear explanations with analogies to shell. - **Improve**: Link to deeper blog posts on functional PHP. 4. **Physical** - **Present**: Copy-paste examples. - **Improve**: Interactive sandboxes to try pipes live. 5. **Logical** - **Present**: Step-by-step transformations. - **Improve**: Decision trees on when to use pipes vs. methods. 6. **Social** - **Present**: Encourages RFC participation. - **Improve**: Host live code-along sessions. 7. **Solitary** - **Present**: Reflection on syntax sugar benefits. - **Improve**: Add journaling prompts on refactoring pipelines. 8. **Naturalistic** - **Present**: None. - **Improve**: Use stream waterflow metaphors for pipelines. ## 🔍 Accessibility Assessment - **Screen Reader**: Semantic headings; code blocks labeled. - **Improve**: Add descriptive alt-text for pipeline flow images if added. - **Keyboard Navigation**: Standard blog layout; ensure skip links. - **Contrast**: High-contrast text; confirm in CSS. - **Text Resizing**: Responsive typography; verify across devices. ## 🌍 DEIB Assessment - **Cultural Relevance**: Universal coding concept; no bias. - **Inclusive Language**: Neutral, accessible; defines terms (`callable`). - **Neurodiversity**: Dense history section; break into bullets. - **Representation**: Features contributions from diverse PHP community members. - **Psychological Safety**: Encourages participation; acknowledges prior failures. ## ✅ Logical validity - **Strong Inductive Reasoning**: Examples illustrate general benefits. - **Causal Reasoning**: Syntax sugar → cleaner code → lower overhead. - **Suggestion**: Cite empirical refactoring case studies to solidify claims. - **No fallacies** detected; argument flows coherently from concept to impact. ## 🔍 DARVO Analysis No Deny, Attack, or Reverse Victim/Offender tactics. Tone is collaborative, retrospective, and forward-looking. ## 🔍 SEO Evaluation 1. **Keywords**: “PHP 8.5,” “pipe operator,” “functional patterns” in title and first paragraph. 2. **Meta Description**: Missing—recommend: > “Learn how PHP 8.5’s new pipe operator (`|>`) enables concise, chained function calls and advanced functional patterns.” 3. **Title Tag**: Under 60 characters; includes primary keyword. 4. **Headers**: H1 & H2 used effectively to structure content. 5. **Content Length**: ~1,500 words—comprehensive coverage. 6. **Links**: Internal to php.net RFCs; external to examples; good balance. 7. **URL**: SEO-friendly. 8. **Images**: One banner; add illustrative diagrams with alt-text. 9. **Mobile**: Responsive theme confirmed. 10. **Engagement**: Comments and GitHub edit link invite contributions. 11. **Schema**: Likely uses Article schema; verify. 12. **Social**: Icons present; ensure Open Graph tags optimized. ## 🎯 Conclusion The pipe operator delivers high-impact syntax sugar for PHP, condensing multi-step transformations into readable pipelines and unlocking functional paradigms—marking a significant language milestone and setting the stage for richer composition and partial-application features. ## Highlights - While powerful, it was also somewhat limiting. It was very non-standard, unlike any other language. It also meant a weird, one-off syntax for partially-calling functions that worked only when paired with pipes. ([View Highlight](https://read.readwise.io/read/01k34a2hhx3c8gz9dvg26qj560))