note 108675 deleted from function.array by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 May 2012 21:01:35 +0000 |
| Subject: | note 108675 deleted from function.array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188020@lists.php.net to get a copy of this message | ||
Note Submitter: bubrak at pinknet dot cz
----
Just wanted to enter better keys swap function as the old one mentioned bellow will not handle
multi-associative array (i.e. some_array['banana']['vegetable']). So here we go.
function array_two_key_swap( $a ) {
$ra = array();
while (list($k1,$v1) = each ($a)) {
while (list($k2,$v2) = each ($v1)) {
$ra[$k2][$k1]=$v2;
}
}
return $ra;
}