Calculate average growth percentage with PHP

Asked

Viewed 76 times

1

I got the following json:

{
  "bpi": {
    "2017-10-31": 21094.2212,
    "2017-11-01": 22052.8615,
    "2017-11-02": 22972.5023,
    "2017-11-03": 23730.9012,
    "2017-11-04": 24483.4171,
    "2017-11-05": 24448.8979,
    "2017-11-06": 22610.3597,
    "2017-11-07": 23292.1128,
    }
}

I needed to take and calculate on average how much it increases per day. I don’t have any code yet because I haven’t figured out how to do this calculation with PHP.

  • For example he will take the day 31 and compare with 01 and has a result of 104.54456360778 that is to say, 105%? I didn’t quite understand

  • Not just from the 1st to the 31st. It has to see the growth type from day 01 to day 02, from day 02 to 03, etc... and say that on average the value grows X% to day

  • I didn’t just say I said example, what is the average then of the first day and the second day?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.