02 7 / 2012

One of the most awesome things about python is its ability to pass parameters by name to a function, for those of you who don’t know it look something like this:

my_foo_function(param_name="value", another_param_name="another value")

Today I wanted to do same in PHP 5.4 (can be easily ported to 5.3), so I thought of making a call_user_func_named just like the PHP native one call_user_func_array, here is the gist, you are open to contribute, modify or reuse in whatever way you like. Have fun!

Update: thanks to some nice contributors here are improvements in existing code

  1. maxpert posted this