note 28814 deleted from function.key by danbrown
| From: | danbrown@php.net | Date: | Sat, 28 Mar 2009 23:10:35 +0000 |
| Subject: | note 28814 deleted from function.key by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152566@lists.php.net to get a copy of this message | ||
Note Submitter: shimon_d at hotmail dot com
----
make array[a][b]
be array[b][a]
function invertarray($a)
{
$o=array();
foreach($a as $k => $aa)
{
foreach($aa as $k1 => $v)
{
if(!isset($o[$k1]))$o[$k1]=array();
$o[$k1][$k]=$v;
}
}
return $o;
}