0

This seems like a very simple question, but I just can not figure it out! I have a var_dump from a variable I create which contains a multi-dimensional array. The var_dump is as follows:

array(3) { ["errors"]=> array(1) { [0]=> object(stdClass)#838 (2) { ["code"]=> int(324) ["message"]=> string(80) "Duration too long, maximum:30000, actual:37081 (MediaId: snf:840714426630078465)" } } ["httpstatus"]=> int(400) ["rate"]=> NULL }

What is the code I would use to put the value of key "code" and the value of key "message" in a variable.

I have tried:

$myvar1 = $array[0][1];
$myvar2 = $array[0][2];

But I get "Notice: Undefined offset: 0" every time. Any ideas? Thanks.

Bob C
  • 35
  • 6
  • Do: `echo '
    '; print_r($array);` it will make it more clear.
    – Aziz Saleh Mar 12 '17 at 01:33
  • Take a look a the documentation about [PHP arrays](http://php.net/manual/en/language.types.array.php) (example #6 is a good source of ideas regarding multi-level arrays) and [PHP Objects](http://php.net/manual/en/language.types.object.php#language.types.object.casting). Also, [`print_r()`](http://php.net/manual/en/function.print-r.php) helps you more to understand the structure, [`var_dump`](http://php.net/manual/en/function.var-dump.php) is good when you have doubts about the data type and padding spaces. – axiac Mar 12 '17 at 01:36

0 Answers0