On 1/12/2013 10:46 AM, Alexey Zakhlestin wrote:

On 12.01.2013, at 21:34, Thomas Hruska <thru...@cubiclesoft.com> 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/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to