![]() |
|
? |
![]() PHP FAQ PHP Articles PHP Help Bulletin Board PHP Manual (NEW!) First Time PHP'ers Help with programming Sql assignment help PHP Homework Help C# Help
|
? |
|
|||||||||||||||||||||||||
?Reply To This Message | ||||||||||||||||||||||||||||
?Your Name: | ||||||||||||||||||||||||||||
?Your Email: | ||||||||||||||||||||||||||||
?Subject: | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
Email replies to this thread, to the address above. | ||||||||||||||||||||||||||||
??wrote: > > sorry, my bad...its your foreach statement that is screwy > > foreach($cities as $destination=>$distance){ > if ($miles < 500) { > print "Destination $Destination Distance = $miles "; > }elseif (($miles>500) && ($miles < 1000)){ > print "Destination $Destination Distance = $miles "; > }elseif (($miles>1000) && ($miles < 1500)){ > print "Destination $Destination Distance = $miles "; > } > > }//close for each loop > > you only need one foreach loop for the array and a bunch of > if/elseif statements to print out what you want to ....note > that from the code your if/elseif don't make much sense...the > <> symbol is not equal and none of the value are equal to any > of those statements...not sure what the goal of the exercise > is, but either less than or greater than may be more useful > to you... ">?? ![]() |