如何解析数组元素?

I tried to parse a string array using the code below but the required data never printed! could any one tell me how to fix it ?Thanks

$data Array structure :

Array
(
    [js] => Array
        (
            [total_items] => 20
            [max_page_items] => 2
            [selected_item] => 0
            [cur_page] => 0
            [data] => Array
                (
                    [0] => Array
                        (
                        [tmp] => 1
                        [name] => mango
                        [abc] => abcd4 http://mysite/items/1234
                        [number] => 1123
                        [itemCategory_title] => fruits
                        [logo] => 2123.png
                        [itemCategory_id] => 90
                        )
                    [1] => Array
                        (
                        [tmp] => 0
                        [name] => cherry
                        [abc] => abcd4 http://mysite/items/1235
                        [number] => 1124
                        [itemCategory_title] => fruits
                        [logo] => 2124.png
                        [itemCategory_id] => 
                        )

               )

         )

    [text] => no error
)

php code:

<?
$code2 = stripslashes($_POST['outputtext']);

$data = json_decode($code2);

foreach( $data as $item ) {
  echo $item['tmp'];
  echo $item['name'];
  echo $item['abc'];
  echo $item['number'];
  echo $item['itemCategory_title'];
  echo $item['log'];
  echo $item['itemCategory_id'];    
}

?>

It should be:

foreach ($data['js']['data'] AS $item)

because the array is nested several levels down in $data.

Note that you need to call json_decode($code2, true) to get an associative array like that. By default, it returns an object, not an array, so you would do:

foreach ($data->js->data as $item) {
    echo $item->tmp;
    echo $item->name;
    ...
}