strtotime($b['year']); }); $artist['albums'] = array(); while(list( $i, $rg ) = each($release_groups)) { $t_list = array(); $b_list = array(); $tracks = array(); $bonus = array(); $r = current($rg['releases']); if (count($r['tracks']) > 0) { while(list( $j, $t ) = each($r['tracks'])) if ($t['name'] != '[silence]') { $t_list[] = strtolower($t['name']); $tracks[] = array('id' => $t['id'], 'name' => $t['name'], 'duration' => round($t['length'] / 1000)); } while(list( $j, $r ) = each($rg['releases'])) { while(list( $k, $t ) = each($r['tracks'])) if ($t['name'] != '[silence]') { if (!in_array(strtolower($t['name']), $t_list) && !in_array(strtolower($t['name']), $b_list)) { $bonus[] = array('id' => $t['id'], 'name' => $t['name'], 'duration' => round($t['length'] / 1000)); $b_list[] = strtolower($t['name']); } } } } $artist['albums'][] = array( 'name' => $rg['name'], 'year' => $rg['year'], 'tracks' => $tracks, 'bonus' => $bonus ); } include 'tpl/index.php';