RVP Posted December 17, 2019 Share Posted December 17, 2019 Sir, I have php array { "DiplomaFirstYear": { "2016-2017.1": 3.88, "2016-2017.2": 4, "2016-2017.3": 3.3 }, "DiplomaSecondYear": { "2016-2017.3": 4, "2017-2018.1": 3.88, "2017-2018.2": 3.94, "2017-2018.3": 3.3 }, "AdvancedDiploma": { "2017-2018.3": 4, "2018-2019.1": 3.74, "2018-2019.2": 3.62 }, "Bachelor": { "2018-2019.3": 3.15 } } in this 2016-2017.3 in DiplomaFirstYear and 2016-2017.3 in DiplomaSecondYear want to calculate average and add those values in those two positions. Can u please help me. Quote Link to comment https://forums.phpfreaks.com/topic/309695-php-sub-key-average/ Share on other sites More sharing options...
gizmola Posted December 17, 2019 Share Posted December 17, 2019 No that is not a php array. That is json. What have you tried? If you don't know where to start, start by turning it into a php array using json_decode. Your actual question doesn't make sense. Average of which values? Quote Link to comment https://forums.phpfreaks.com/topic/309695-php-sub-key-average/#findComment-1572573 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.