php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48268 Special case of a function with single array argument
Submitted: 2009-05-13 20:20 UTC Modified: 2009-05-13 22:22 UTC
From: zyss at mail dot zp dot ua Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.9 OS: Irrelevant
Private report: No CVE-ID: None
 [2009-05-13 20:20 UTC] zyss at mail dot zp dot ua
Description:
------------
I propose to add a special syntax (simplification) for a function declared with just one argument. The idea is to remove array with its brackets ( ) in the function call to improve readability and get rid of unneeded array keyword. This feature is expected by many people who use such type of functions as a replacement of the PHP's missing feature to specify function's arguments by name.

For example:

  function setParams(array $params) { /*...*/ }

Current call:

  setParams(array('name' => 'foo', 'width' => 300, 'height' => 150));

Proposed call:

  setParams('name' => 'foo', 'width' => 300, 'height' => 150);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-13 22:22 UTC] johannes@php.net
This has been discussed multiple times ad is not planned for future releases. Please check archives of the "internals" list for in-depth discussions and arguements.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 07:01:31 2024 UTC