On Sat, 14 Mar 2020 at 15:43, Midori Koçak <mtko...@gmail.com> wrote:
> Dear Internals, > > I would like to as you a question. I know that it is possible to use an > array to function parameters like: function(...array); But this method is > not working when the array is associative. > > Would not be fine if an array like ['param1'=>'value', 'param2' => 'value'] > would be used in a function like function(param1, param2) regardless of the > order? > > I think it would make our lives is easier. I'd be also happy if you know if > there is more effective method to achieve the same result. > > Thanks, > Midori > What you are looking for are Named Parameters, there have been multiple RFCs about which have all been more or less abandoned from what I see. https://wiki.php.net/rfc/namedparameters (From 2012) https://wiki.php.net/rfc/named_params (From 2013) https://wiki.php.net/rfc/simplified_named_params (From 2016) On a side note, I don't think this feature is *that* useful and if you get to the point where you want to know which value you are passing to which argument it seems, to me, that the function is having too many arguments. Also IDEs exist and can tell you the name of the argument. Best regards George P. Banyard