Linear Relationship Of Array Values
Posted 20 September 2011 - 6:22 AM
I have the following arrays:
a height_array value corresponds to a value in the volume_array with the same key.
Does someone know how to efficiently get the corresponding volume for a height of 7 assuming a linear relationship?
I have been looking at the php array functions for sometime now without any luck.
Posted 21 September 2011 - 8:10 AM
$key = array_keys($height_array, 7);
Then $volume_array[$key] gets you the value you need.
Posted 21 September 2011 - 12:12 PM
When i try i get the message "Warning: Illegal offset type"
This i believe is due to the fact that ( i may be wrong though) "7" is not in the height_array it is to be extrapolated between 5 and 8.
Posted 28 September 2011 - 9:56 AM