Reputation: 105
I have Some API that returning me Results in JSON Format, I successfully Converted it into Multi-Dimensional Array.
Array
(
[status] => success
[cdr] => Array
(
[0] => Array
(
[date] => 2017-04-01 05:14:00
[callerid] => "ABC" <61344341227>
[destination] => 1604535320207
[description] => ABC1
[account] => ABC1
[disposition] => ANSWERED
[duration] => 10:57:57
[seconds] => 437
[rate] => 0.00200000
[total] => 0.06480000
[uniqueid] => 105943343
)
[1] => Array
(
[date] => 2017-04-11 05:10:00
[callerid] => "XYZ" <61343241227>
[destination] => 16045353250207
[description] => XYZ1
[account] => XYZ1
[disposition] => ANSWERED
[duration] => 13:57:57
[seconds] => 447
[rate] => 0.01100000
[total] => 0.06411000
[uniqueid] => 105911143
)
)
)
Kindly Help me in Fetching Data in Rows/Columns.
I wrote Below Code But it's saying undefined offset ....
foreach( $curl_jason as $key => $value)
{
echo $key;
echo $value['callerid'];
}
Upvotes: 0
Views: 30
Reputation: 26258
Try this:
foreach( $curl_jason['cdr'] as $data)
{
echo $data['callerid']; // will print callerid value
}
Upvotes: 3