0

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'];
}
1
  • In rows and columns, do you mean a HTML table? Commented Apr 22, 2017 at 6:43

1 Answer 1

3

Try this:

foreach( $curl_jason['cdr'] as $data)
{
  echo $data['callerid'];  // will print callerid value
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.