note 46886 deleted from function.array-combine by aidan
| From: | aidan@php.net | Date: | Sat, 22 Jan 2005 12:22:58 +0000 |
| Subject: | note 46886 deleted from function.array-combine by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83776@lists.php.net to get a copy of this message | ||
Note Submitter: Phin
----
Typo in kevlar at ccs dot neu dot edu
Kevlar's excellent function works a treat, but there is a typo...
$a = array_values($a);
should be
$a = array_keys($a);
to give:
function arraycombine($a, $b)
{
$num = count($a);
if ($num != count($b) || $num == 0) return false;
$a = array_keys($a);
$b = array_values($b);
$c = array();
for ($i = 0; $i < $num; $i++)
$c[$a[$i]] = $b[$i];
return $c;
}