note 46886 added to function.array-combine

From: Date: Wed, 27 Oct 2004 01:38:49 +0000
Subject: note 46886 added to function.array-combine
Groups: php.notes 
Request: Send a blank email to php-notes+get-79154@lists.php.net to get a copy of this message
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; } ---- Manual Page -- http://www.php.net/manual/en/function.array-combine.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46886 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46886&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46886&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46886&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46886&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46886&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46886&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46886&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79154) next »