RE: Array Search Not Working?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> I'm still a little foggy on what you're doing, but doing, but does this
> help?
> 
> $from = explode("-", $from);
> $state_colors = explode("-", $state_colors);
> $change = explode("-", $change);
> 
> $old = array_combine($from, $state_colors);
> $new = array_combine($from, $change);
> 
> //show all values
> foreach($old as $key => $val) {
> 	echo "{$key}  old={$old[$key]}  new={$new[$key]}<br />\n";
> }
> 
> //lookup a particular value
> $test = "Muskogee, OK";
> echo "TEST={$test}  old={$old[$test]}  new={$new[$test]}<br />\n";
> 

Well, here is the weird part. put up the last 3 lines of your code here into mine, and here is the output:TEST=Muskogee, OK old= new= 
I am starting to wonder if there are other things hidden inside the "values" that seems like that the values of the new array (the state and counties part) are the same as the original when I tried to do the comparison. This is what I mean by the fact that my array_search does not work, and all I am trying to do is to find the index, so I can do stateColors[$index] later on and color my map. 

Have I done something wrong here that causes the code you provided not to spit out anything here? This is what I have:

$from = explode("-", $from);
$state_colors= explode("-", $state_colors);
$change = explode("-",$change);

$new_array = array_combine($from,$change);
asort($new_array);

foreach ($new_array as $key => $value) echo $key . " is " . $value . " miles away<br />";

Thanks. 

Alice
 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/201469226/direct/01/

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux