Re: Creating an assoc array from two arrays

From: Date: Fri, 23 Apr 2004 19:20:59 +0000
Subject: Re: Creating an assoc array from two arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184457@lists.php.net to get a copy of this message
From: "Alex Hogan" <Alex.Hogan@AlliedElec.com> > I am looking through the manual and I think I may be blind or something, but > how can I create an associative array from two arrays. > What I have is two arrays that look like this; > > Array1([0]=>Spider, [1]=>Monkey, [2]=>Cards) > Array2([0]=>26.3, [1]=>0.65, [2]=>62.07) > > I want to combine them into; > > ArrayCombined([Spider]=>26.3, [Monkey]=>0.65, [Cards]=>62.07) > > So I can compare it to a third array. foreach($array1 as $key => $value) { $arraycombined[$value] = $array2[$key]; } ---John Holmes...

« previous php.general (#184457) next »