I have a json object and I wanted to access it in the loop using php. Is there a way I can access it in the loop without even decoding it? Please help. Here is my code.
for($i = 0; $i < count($purchases); $i++){ ?>
<tr class="tr-purchase">
<td>{{ $purchases[$i]['purchase_orders'] }}</td>
</tr>
}?>
{"id":35,"po_code":"PMS201635","purchase_orders":"a:2:{i:0;a:7:{s:2:\"id\";s:1:\"9\";s:3:\"qty\";s:1:\"2\";s:4:\"unit\";s:7:\"Capsule\";s:6:\"pharma\";s:12:\"Ibuprofen IB\";s:9:\"packaging\";s:7:\"50 caps\";s:5:\"price\";s:2:\"23\";s:5:\"total\";s:2:\"46\";}i:1;a:7:{s:2:\"id\";s:2:\"11\";s:3:\"qty\";s:1:\"5\";s:4:\"unit\";s:6:\"Pieces\";s:6:\"pharma\";s:12:\"Ecotrin oral\";s:9:\"packaging\";s:6:\"100pcs\";s:5:\"price\";s:2:\"13\";s:5:\"total\";s:2:\"65\";}}","freight_charge":"0","overall_total":"111","created_at":"2016-05-21 16:50:49","updated_at":"2016-05-21 16:50:49","shipped_via":"Select","terms":""}
I just wanted to access some values inside the object. How can I access it? Thank you.
json_decode
and access it as array. – Frayne Konok May 29 '16 at 8:04purchase_orders
its also another json, Specify what data you need? – Frayne Konok May 29 '16 at 8:09