How to access array element values using array-index?
$json = \'{ \"dynamic\":{ \"pageCount\":\"12\", \"tableCount\":\"1\" } }\'; $a
$arr = json_decode($json, true); foreach ($arr as $key => $value) { if (isset($value['pageCount'])) { //do something with the page count } }
If the structure is always a single nested JS object:
$obj = current($arr); echo $obj['pageCount'];