Each time through the loop, you are reassigning $mp3dataArray
. You probably want to append to the array rather than just replace it each time.
James McLeod
2010-04-13 17:36:55
Each time through the loop, you are reassigning $mp3dataArray
. You probably want to append to the array rather than just replace it each time.
try this
<?php
$mp3testarray = array();
foreach ($mp3data as $key => $val) {
$mp3datafile = $val;
$m = new mp3file($mp3datafile);
$mp3dataArray = $m->get_metadata();
$mp3testarray[] = array($mp3dataArray);
}
// check $mp3testarray[]
print_r($mp3testarray);
?>
try this code:
<?php
$mp3dataArray = array(); //get array ready for each file
foreach ($mp3data as $key => $val) { //for each file in dir
$m = new mp3file($val); //get current file's mp3 info
$mp3dataArray[] = array($m->get_metadata()); //store current mp3 info in next array element
}
var_dump($mp3dataArray); //display all of the array's contents
?>