Re: Need help accessing the key array. [message #185490 is a reply to message #185473] |
Fri, 04 April 2014 02:13 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Wed, 02 Apr 2014 09:57:15 -0700, Kevin Burton wrote:
> That is what I meant when I said what if you cannot change the input.
> You replied, "what input?". The input was the array that was specified
> in the original question.
No, the array that was specified in the original question was not input,
although it could be described as data held within the program that.
Input is information that is provided to the program at run time. Not
data that is part of the program.
In the problem as originally posted, all the data was contained within
the program code. There was no separate input data.
The answer to the first question the OP asked (How to access the $rates
array to echo the associated rate of "animal" => 1 and "color" => 2 ?) is:
$rates[3*$input_animal+$input_color]["rate"]
The answer to the second question the OP asked (should i re-designed the
$rates array) is:
Yes, there are much better ways to design your data array.
The answer to "Does Kevin Burton respect usenet etiquette" is clearly:
No, he can't be bothered to respect nearly 35 years of usenet etiquette.
--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
|
|
|