Description:
------------
Hello!
I know this feature request has been made a few times in the last years, but I
want to reopen this request to add arguments in favor to this feature request.
It would be really nice for developper to be able to call a function like this:
func($param1 => 'value1', $param2 => 'value2');
or a similar way.
The func function would be defined that way:
function func(...$options) {}
or another syntax.
This way, we've got not problem with documentation if we compare to the "array-
way".
The goal of this syntax is to simplify the function call and get shorter code.
Not convinced?
Let's compare two web framework: one in a language that support named function
parameters and one that doesn't.
Drupal (PHP) and Django (Python).
Drupal uses the "array-way" as you recommend.
Here is the way Drupal allows us to create a database table model:
http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_schema/7
(go down to the code section)
And look at the "named-parameter-way" in Django in the Test script.
The code is almost five times shorter in python, because of the use of named
parameters.
It is the primary reason to include this syntax in PHP:
we can get shorter and cleaner code.
Thanks for considering this feature request once again.
And I hope you will do the right choice now.
I am open to argumentation.
Test script:
---------------
Python code almost equivalent to the Drupal code:
from datetime import datetime
from django.db import models
class Node(models.Model):
vid = models.PositiveIntegerField(default=0, null=False, unique=True)
changed = models.DateTimeField(default=datetime.now, db_index=True, null=False)
created = models.DateTimeField(default=datetime.now, db_index=True, null=False)
type = models.CharField(default='', max_length=32, null=False)
title = models.CharField(default='', max_length=255, null=False)
revision = models.ForeignKey('NodeRevision')
author = models.ForeignKey('User')