Currently I have the following code.
<?php
$jsonFP = '[{"Maths":{"earlierMarks":85,"currMarks":90}},{"Physics":{"earlierMarks":80,"currMarks":85}},{"Science":{"earlierMarks":82,"currMarks":85}},{"Social":{"earlierMarks":75,"currMarks":60}}]';
$histData=json_decode($jsonFP,true);
print_r($histData);
$subject_list = array("Social","Maths","Physics");
foreach($subject_list as $subject){
print_r($histData[$subject]);
echo "
";
}
?>
But this print_r($histData[$subject]); statement expects index like this print_r($histData[some index][$subject]);
How can I access the values in $histData dynamically while looping for $subject_list