This question already has an answer here:
I call a function to get an array and use var_dump()
the result is the following array:
array(1) {
[0]=> array(12) {
["access_id"] => string(1) "1"
["invoice_id"] => NULL
["invoice_public_id"] => NULL
["invoice_payment_id"] => NULL
["invoice_item_id"] => NULL
["user_id"] => string(1) "1"
["product_id"] => string(1) "2"
["transaction_id"] => NULL
["begin_date"] => string(10) "2015-12-24"
["expire_date"] => string(10) "2016-01-24"
["qty"] => string(1) "1"
["comment"] => string(0) ""
}
}
I only need this part :
["product_id"]=> string(1) "2"
How can i get that part only from the array?
</div>
You can simply access the value directly:
echo $myArray[0]['product_id'];
You may want to start reading the documentation about arrays in php: http://php.net/manual/en/language.types.array.php
var_dump($yourArray[0]['product_id']);
You should not use var_dump for production, only for debugging.