Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64903 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93784 invoked from network); 12 Jan 2013 19:42:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2013 19:42:20 -0000 Authentication-Results: pb1.pair.com header.from=thruska@cubiclesoft.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=thruska@cubiclesoft.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cubiclesoft.com designates 74.208.44.107 as permitted sender) X-PHP-List-Original-Sender: thruska@cubiclesoft.com X-Host-Fingerprint: 74.208.44.107 u15404699.onlinehome-server.com Received: from [74.208.44.107] ([74.208.44.107:54866] helo=u15404699.onlinehome-server.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/BD-24230-B9CB1F05 for ; Sat, 12 Jan 2013 14:42:19 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: thruska@cubiclesoft.com) with ESMTPSA id 11E7850000AE Message-ID: <50F1BC83.30800@cubiclesoft.com> Date: Sat, 12 Jan 2013 12:41:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: PHP Development References: <50F19EA2.8040600@cubiclesoft.com> <50F07A56-A414-434F-804D-1E5B7039F728@gmail.com> In-Reply-To: <50F07A56-A414-434F-804D-1E5B7039F728@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] array_map() function modification From: thruska@cubiclesoft.com (Thomas Hruska) On 1/12/2013 10:46 AM, Alexey Zakhlestin wrote: > > On 12.01.2013, at 21:34, Thomas Hruska wrote: > >> This would allow developers to do things like: >> >> $keys = array('key1', 'key2', ..., 'keyn'); >> $vals = array('val1', 'val2', ..., 'valn'); >> >> $somemap = array_map($keys, $vals); >> >> Which would result in $somemap containing: >> >> array('key1' => 'val1', 'key2' => 'val2', ..., 'keyn' => 'valn') > > There is a function for this: > > http://docs.php.net/array_combine Hmm...never knew about that one. It seems poorly named. The array_map() changes would allow for multiple arrays of values: array_map($keys, $vals, $vals2, $vals3); Which I suppose could be emulated with a combination of array_combine() with array_map(): array_combine($keys, array_map(null, $vals, $vals2, $vals3)); But it would execute faster if it were supported in array_map(). If it is supported in array_map(), then array_combine() could call array_map() and could potentially just be an alias to array_map(). -- Thomas Hruska CubicleSoft President I've got great, time saving software that you might find useful. http://cubiclesoft.com/