JREAM Posted November 29, 2008 Share Posted November 29, 2008 If you look at the // COUNTER thats where im counting the files, Im trying to get all the files into an array, then print them (so i can sort, and do all kinds of stuff) but i only get 1 file to list #IGNORE ALL THIS function list_all_mp3 () { $directory = 'public/downloads/audio/'; $results = array(); $handler = opendir($directory); # HERE THE COUNTER $i = 0; // COUNTER while ($file = readdir($handler)) { if ($file != '.' && $file != '..') { # HERE THE COUNTER $i++; // COUNTER $mp3 = $file; $filesize = filesize($directory . $mp3); $fh = fopen($directory . $mp3, "r"); fseek($fh, -128, SEEK_END); $tag = fread($fh, 3); if($tag == "TAG") { $title = trim(fread($fh, 30)); $speaker = trim(fread($fh, 30)); } else die("MP3 file does not have any ID3 tag"); fclose($fh); # HERE THE ARRAY $aud1 = array($i, "<a name='$mp3' href='$directory$mp3'><strong>$title</strong></a></li>\n"); /*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*/ } } closedir($handler); var_dump($aud1); } Link to comment https://forums.phpfreaks.com/topic/134741-dump-content-into-array-and-sort/ Share on other sites More sharing options...
JREAM Posted November 29, 2008 Author Share Posted November 29, 2008 Cuz i can do an if ($i == '50') { echo "</td><td>" .... and sort that way, but itd be nice to automate :PP Link to comment https://forums.phpfreaks.com/topic/134741-dump-content-into-array-and-sort/#findComment-701647 Share on other sites More sharing options...
Barand Posted November 29, 2008 Share Posted November 29, 2008 try $aud1[$i] = "<a name='$mp3' href='$directory$mp3'><strong>$title</strong></a>\n"; Link to comment https://forums.phpfreaks.com/topic/134741-dump-content-into-array-and-sort/#findComment-701649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.