note 52716 deleted from function.array-combine by aidan

From: Date: Wed, 03 Aug 2005 03:05:17 +0000
Subject: note 52716 deleted from function.array-combine by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-92979@lists.php.net to get a copy of this message
Note Submitter: ungu at terong dot com ---- 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); ?>

« previous php.notes (#92979) next »