note 52716 added to function.array-combine

From: Date: Tue, 10 May 2005 18:52:23 +0000
Subject: note 52716 added to function.array-combine
Groups: php.notes 
Request: Send a blank email to php-notes+get-89226@lists.php.net to get a copy of this message
Sorry for the mistype in previous submission, here is the correct one completed with a sample. Simpler version of array_combine if you do not use PHP 5 <? if(!function_exists('array_combine')) function array_combine($a, $b) { $c = array(); $at = array_values($a); $bt = array_values($b); foreach($at as $key=>$aval) $c[$aval] = $bt[$key]; return $c; } $a = array('green', 'red', 'yellow'); $b = array('avocado', 'apple', 'banana'); $c = array_combine($a, $b); print_r($c); ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-combine.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52716 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52716&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52716&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52716&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52716&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52716&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52716&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89226) next »