> -----Original Message----- > From: Jim Lucas [mailto:[EMAIL PROTECTED] > Sent: 02 June 2003 18:07 > To: Jim Lucas; Rasmus Lerdorf; Ralph > > Answering my own answer. I see now how you are extracting > the sub array > information. > > My mistake.
Notwithstanding that, I think your question was a good one -- it seems to me that the use of a nested array is unnecessary complex for this application; if we go with your simplified simple array: > > > > $rates = array('7.45'=>20, > > '8.45'=>35, > > '9.45'=>55, > > '10.45'=>80, > > '11.45'=>100, > > '13.45'=>150, > > '15.55'=>200, > > '19.45'=>999999999); then the foraech can surely be written very simply like this: foreach($rates as $i => $vals) { if($num <= $vals) { $price = $i; break; } } return $price; Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php