helper("mw_helper_out"); $audio_files = array(); foreach($documents as $id_document => $document){ $ext = ""; if(($k = strrpos($document["url"], ".")) !== false) $ext = strtolower(substr($document["url"], $k + 1)); switch($ext){ case "ogg": $audio_files[] = array( "type" => "audio/ogg", "src" => $document["url"] ); break; case "mp3": $audio_files[] = array( "type" => "audio/mp3", "src" => $document["url"] ); break; } } if($audio_files) : ?>