php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #37155 func_get_args feature change request
Submitted: 2006-04-21 14:49 UTC Modified: 2018-05-05 18:06 UTC
From: akari dot no dot ryu at whitedragons dot org Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.1.2 OS: Mac OS/X
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: akari dot no dot ryu at whitedragons dot org
New email:
PHP Version: OS:

 

 [2006-04-21 14:49 UTC] akari dot no dot ryu at whitedragons dot org
Description:
------------
Is it possible to make func_get_args return a hashed array instead of a numeric one? Possibly by adding an argument to it.

Reproduce code:
---------------
function changeProfileDetails($userId, $password, $surname){
 echo "<!--\n";
 foreach(func_get_args() as $key=>$val){
   echo "$key=>$val";
 }
 echo "-->";
}

changeProfileDetails(1, "test", "whoCares");

Expected result:
----------------
<!--
  userId=>1
  password=>'test'
  surname=>'whoCares'
-->

Actual result:
--------------
<!--
  0=>1
  1=>'test'
  2=>'whoCares'
-->

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-05-05 18:06 UTC] requinix@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2018-05-05 18:06 UTC] requinix@php.net
Old request is old.

I don't see a good reason for this. If it's for debugging then you can look up parameter names with Reflection. If it's for convenience (eg, SQL column names) then I would recommend against it and you should construct the array manually.
If there's still any interest in making this happen then we can reopen.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 14:01:31 2025 UTC