As rhukster said, Twig supports named arguments. For me it seems to be support it "automagically" without any modifications to custom filters and extensions (correct me if I'm wrong). For a usage example, see here http://de.slideshare.net/javier.eguiluz/twig-tips-and-tricks at slide 28.
Concerning PHP, although it doesn't provide support for named arguments, you can write your own program implementing at least partially the behavior. I did this in my Variadic program
https://github.com/Sommerregen/variadic
i.e. when using (note the associative array 'transform' => "strtoupper")
<?php
function concatenate($transform, $args) {
...
}
echo call_user_variadic_array('concatenate', array("I'd ",
"like ", 4 + 2, " apples", 'transform' => "strtoupper"));
// result: "I'D LIKE 6 APPLES"
?>
You can have a look into this. It basically make use of the Reflection class, thus it could have performance implications.