What am I doing wrong here? Consider this array:
Array
(
[post_id] => 2
[attachment_id] => 48
[link] => http://conveyorbelts/wp-content/uploads/capsule.jpg
[source] => http://conveyorbelts/wp-content/uploads/capsule.jpg
[width] => 150
[height] => 113
[image_size] => thumb
[meta_data] => Array
(
[width] => 200
[height] => 151
[hwstring_small] => height='96' width='127'
[file] => capsule.jpg
[sizes] => Array
(
[thumbnail] => Array
(
[file] => capsule-150x150.jpg
[width] => 150
[height] => 150
)
)
[image_meta] => Array
(
[aperture] => 0
[credit] =>
[camera] =>
[caption] =>
[created_timestamp] => 0
[copyright] =>
[focal_length] => 0
[iso] => 0
[shutter_speed] => 0
[title] =>
)
)
[mime] => image/jpeg
[filename] => capsule.jpg
[class] =>
)
I would like to access the value "capsule-150x150.jpg". So I write:
(line 61) echo $myarray['meta_data']['sizes']['thumbnail']['file'];
It echos out:
capsule-150x150.jpg<br />
<b>Fatal error</b>: Cannot use string offset as an array ... on line 61
It is weird that it does output the string but then falls over. Any ideas. How do you reference multiple nested arrays correctly?