Skip to content
Wade Womersley

wade.one

wade womersley – york based software engineer

  • Home
  • 2026
  • August
  • 18
  • PHP 8.6 Partial Function Application Might Actually Make Callbacks Nicer

PHP 8.6 Partial Function Application Might Actually Make Callbacks Nicer

Posted on August 18, 2026 By
PHP, Programming

PHP callbacks have improved a lot, but there are still places where a tiny arrow function exists only to fill in one argument later. PHP 8.6’s partial function application is meant to remove that ceremony. I can see it being genuinely useful, as long as people do not turn every call into a puzzle made of placeholders.

The accepted partial function application RFC lets ? stand for one argument that will be supplied later and ... accept zero or more remaining arguments. Something like str_replace('old', 'new', ?) produces a closure waiting for the subject. It keeps the original callable’s parameter information rather than forcing you to repeat it in an arrow function.

That should make common mapping, filtering, and pipeline code shorter without hiding the actual operation. It also supports delayed execution: supply the required values with ..., keep the returned closure, and call it when the work should happen. The important detail is that fixed argument expressions are evaluated when the partial function is created, not later when it is called.

My rule would be simple: use it when the result reads like an obvious configured function. If somebody needs to count placeholders or remember a clever argument order, write the closure out properly. PHP has finally gained a neat tool here. That does not mean every anonymous function is now a code smell.

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: callbacks closures php php-8-6

Post navigation

❮ Previous Post: PHP 8.6 clamp Is Tiny but Welcome

You may also like

Programming
MongoDB vs DocumentDB
March 26, 2023
Programming
Regex-fu #PHPUK2010
February 26, 2010
Programming
.NET 10 Is the C# Upgrade That Matters
May 18, 2026
AI
Android Studio Gemma 4 Is Really About Local Agent Trust
June 8, 2026
  • 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