I have a problem about array(), help me!

I have an array:




array(1) { 

   [0]=> array(10) { 

        ["kind_of_promotion"]=> int(1) 

        ["id"]=> string(1) "0" 

        ["id_book"]=> string(4) "6184" 

        ["id_book_source"]=> string(3) "347" 

        ["id_cat"]=> NULL 

        ["barcode"]=> NULL  

        ["date_released"]=> string(10) "1401728460" 

        ["qty"]=> string(1) "1" 

        ["image"]=> string(0) "" 

        ["name"]=> string(46) "GREEN TECHNOLOGY AND SUSTAINABLE DEVELOPMENT 1" 

       } 

  } 

I want to get "id_book" in this array, how to get it ? help me please !




$bookId = $arrayName[0]['id_book'];



If you wanna iterate over the nested array for retrieve all booking_id for example, you should use a foreach like this:




foreach ($data as $key => $value) {

      $bookId = $value['id_book'];

      $Id = $value['id'];

      //whatever you wanna retrieve for the 2nd array

}



Thanks for reply, i have tried 2 ways but it didn’t work,all i get is NULL

Both answers should work. Can you show your PHP code?

OMG !!! my mistake, it has worked. Thanks all