Weird array issue...
Posted: Thu Jul 26, 2012 9:53 am
I have an array the looks like (sorry for the formatting):
Array ( [info] => Array ( [num_results] => 17 [limit] => 100 [offset] => 0 [query] => justin bieber [type] => artist [page] => 1 ) [artists] => Array ( [0] => Array ( [href] => spotify:artist:1uNFoZAHBGtllmzznpCI3s [name] => Justin Bieber [popularity] => 0.68412 ) [1] => Array ( [href] => spotify:artist:3xeiYKNLVh6M7iSh9woPKy [name] => Sean Kingston and Justin Bieber [popularity] => 0.13672 )
What's going on though is that the first two values are "j" and "a" which isn't in the array at all. Something weird is going on with the array indexes (I think). Any ideas?
Array ( [info] => Array ( [num_results] => 17 [limit] => 100 [offset] => 0 [query] => justin bieber [type] => artist [page] => 1 ) [artists] => Array ( [0] => Array ( [href] => spotify:artist:1uNFoZAHBGtllmzznpCI3s [name] => Justin Bieber [popularity] => 0.68412 ) [1] => Array ( [href] => spotify:artist:3xeiYKNLVh6M7iSh9woPKy [name] => Sean Kingston and Justin Bieber [popularity] => 0.13672 )
Code: Select all
foreach($artist_data as $d)
{
foreach($d as $name)
{
if (isset($name['name']))
{
echo $name['name'] . "<br/>";
}
}
}