{$gasName} ->{'breakpoints'}; foreach ($arr as $index => $value) { if ($value <= $concentration && $table->{$gasName}->{'breakpoints'}[$index + 1] >= $concentration) { $bpLow = $value; $bpLowIndex = $index; } if ($value >= $concentration && $table->{$gasName}->{'breakpoints'}[$index - 1] <= $concentration) { $bpHi = $value; $bpHiIndex = $index; } }; $airQualityIndex = (($table->{$gasName}->{'aq'}[$bpHiIndex] - $table->{$gasName}->{'aq'}[$bpLowIndex]) / ($bpHi - $bpLow)) * ($concentration - $bpLow) + $table->{$gasName}->{'aq'}[$bpLowIndex]; return $airQualityIndex; } } ?>