I have the following code:
$gettracks = $$value['recenttracks'][0]['track'];
foreach($gettracks as $songs)
{
extract($songs);
$time = strtotime($date);
$tracks[] = array($time,$artist,$name,$url,$value);
}
Does anyone know why it throws up the error:
"Fatal error: Cannot use string offset as an array"
I can get round it using:
foreach ($$value as $value2)
{
$gettracks = $value2[0]['track'];
}
foreach($gettracks as $songs)
{
extract($songs);
$time = strtotime($date);
$tracks[] = array($time,$artist,$name,$url,$value);
}
Just curious......
Aha, it was an empty array causing the problem.