0

I have returned data from json_decode

$xml = json_decode($res);
$data=$xml->Item;

And when dump $datain my code

array:1 [▼
  0 => {#500 ▼
    +"productCode": "ddddddddddddd"
    +"productNameEN": "xxxxxxxxxxxxxxxxx"
    +"show_in_web": "aaaaaaaaaaa"
    +"visible": "N"
  }
]

I need to count object in each array.

foreach( $data as $itm ){
   dump(count($itm));die();
}

I used count() in foreach loop result return 1. Please help me.

patipat chewprecha
  • 255
  • 2
  • 6
  • 19

0 Answers0