note 49882 deleted from function.array-combine by aidan

From: Date: Tue, 12 Apr 2005 01:51:32 +0000
Subject: note 49882 deleted from function.array-combine by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-87875@lists.php.net to get a copy of this message
Note Submitter: hugh at e-access dot com dot au ---- If you don't want to use, or can't use, the PEAR compatibility package, here is a PHP4 version of the function you can use in the meantime. Should more or less mirror the functionality of the PHP5 version. <?php function array_combine($a1, $a2) { if(count($a1) != count($a2)) return false; if(count($a1) <= 0) return false; $a1 = array_values($a1); $a2 = array_values($a2); $output = array(); for($i = 0; $i < count($a1); $i++) { $output[$a1[$i]] = $a2[$i]; } return $output; } ?>

« previous php.notes (#87875) next »