Easiest way would probably be id3_get_tag($filename, $version)
.
Just provide a string containing the file path and optionally a ID3 Tag version (leave out if you don't know):
$files = array('/folder/file1.mp3', '/folder/file2.mp3');
$tags = array();
foreach($files as $file) {
$tags[$file] = id3_get_tag($file);
// convert genre:
if(array_key_exists('genre', $tags[$file]) && is_integer($tags[$file]['genre'])
&& $tags[$file]['genre'] >= 0 && $tags[$file]['genre'] <= 147) {
$tags[$file]['genre'] = id3_get_genre_name($tags[$file]['genre']);
}
}
$tags
will then be an array like this:
['/folder/file1.mp3'] = array('interpret' => 'John Doe', 'title' => 'PHP is cool', 'genre' => 'Techno')
['/folder/file2.mp3'] = array('interpret' => 'Jane Doe', 'title' => 'ASP is low', 'genre' => 'House')
What keys you actually get from this, depends on the ID3 version of each .mp3 file and the actual content (whatever someone wrote into that file).