While we are on the general thought of arrays on this list, I was
originally going to put in an idea for a new function and let it simmer
for a while. Then I remembered that array_map() almost does what I
want, but not quite. Someone can start a RFC if they like this idea.
I thoroughly
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:
On 1/12/2013 11:46 AM, Alexey Zakhlestin wrote:
There is a function for this: http://docs.php.net/array_combine
Nobody ever knows that one, I use it frequently, so useful.
--
-Clint
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
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);
On Sat, Jan 12, 2013 at 11:41 AM, Thomas Hruska thru...@cubiclesoft.comwrote:
[...]
The array_map() changes would allow for multiple arrays of values:
array_map($keys, $vals, $vals2, $vals3);
[...]
But it would execute faster if it were supported in array_map(). If it is
supported in
I'm not sure that adding this functionality in array_map would actually
execute faster than doing array_combine($keys, array_map(null, $vals,
$vals2, $vals3));. I will need to do some benchmarks to test, but I'm sure
you will only see a performance improvement with extremely large arrays.
Also
On 1/12/2013 1:10 PM, Peter Cowburn wrote:
On 12 January 2013 20:06, Galen Wright-Watson ww.ga...@gmail.com wrote:
Just to be clear, do you mean the result would be:
array($keys[0] = array($vals0[0], $vals1[0], ...),
$keys[1] = array($vals0[1], $vals1[1], ...),
...)