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
Next Post: Furry Meets Work Best When Nothing Much Is Planned ❯

You may also like

PHP
PHP 8.5 NoDiscard Is a Small API Safety Feature
May 11, 2026
Programming
Why I Prefer Explicit Over Magical Defaults
April 20, 2026
Ego-centric
Heterogeneous Parallel Programming – Completed and Certified!
May 15, 2015
Programming
The Hardest Part of Serverless Is Not the Code
April 12, 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

Categories

  • 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

Archives

  • November 2026
  • October 2026
  • August 2026
  • July 2026
  • June 2026
  • May 2026
  • April 2026
  • March 2026
  • August 2023
  • April 2023
  • March 2023
  • April 2016
  • October 2015
  • July 2015
  • June 2015
  • May 2015
  • March 2015
  • February 2015
  • January 2015
  • October 2014
  • December 2013
  • September 2013
  • June 2013
  • October 2012
  • May 2012
  • March 2012
  • February 2012
  • April 2011
  • March 2011
  • October 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009

Copyright © 2026 wade.one.

Theme: Oceanly News Dark by ScriptsTown