Calculating the AQI from the API results

I use PHP. Does anyone have the code needed to calculate the AQI from the results obtained from the API? I would like to match the same number as shown when viewing the purpleair.com map.

Thank you.

Hi @AndyB, we have a post about this which you can read here: How to Calculate the US EPA PM2.5 AQI. It is written in JavaScript, but the equation will be the same.