#49671 [NEW]: Change to first argument of array_map.

From: Date: Fri, 25 Sep 2009 18:56:45 +0000
Subject: #49671 [NEW]: Change to first argument of array_map.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-142890@lists.php.net to get a copy of this message
From: whatchildisthis at gmail dot com Operating system: Windows 2003 PHP version: 5.3.0 PHP Bug Type: Feature/Change Request Bug description: Change to first argument of array_map. Description: ------------ Based on the rise of web based applications, it is common to have applications that allow a user to insert an indefinite number of rows of data (such as an invoice, contact list). It would be great to see array_map take an array of keys as the first argument, also, so that it does the same thing as if the first argument was null, but uses the first array as the keys of the maped arrays, much like array_combine being called on each maped array after. This recycles an already existing function to do something I thought it would already be able to do without the callback. PHP DATA GENERATED FROM HTML FORM OF AN INVOICE: $_POST["Invoice"] = array( "Description" => array( "A widget", "A gadget" ), "Price" => array( '$1.00', '$3.00' ), "Units" => array( 2, 3 ) ); NEW PHP CODE: array_map( array("Description", "Price", "Units"), $_POST["Invoice"]["Description"], $_POST["Invoice"]["Price"], $_POST["Invoice"]["Units"] ); NEW PHP RESULT: array( 0 => array( "Description" => "A widget", "Price" => "$1.00", "Units" => 2 ), 1 => array( "Description" => "A gadget", "Price" => "$3.00", "Units" => 3 ) ) I don't think this feature would be difficult to implement and it would be a great addition to array_map's functionality. -- Edit bug report at http://bugs.php.net/?id=49671&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49671&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49671&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49671&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49671&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49671&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49671&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49671&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49671&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49671&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49671&r=support Expected behavior: http://bugs.php.net/fix.php?id=49671&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49671&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49671&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49671&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49671&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49671&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49671&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49671&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49671&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49671&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49671&r=mysqlcfg

« previous php.bugs (#142890) next »