solved (was: how to join two arrays?) [message #185722 is a reply to message #185704] |
Sun, 04 May 2014 23:54 |
Mr Oldies
Messages: 241 Registered: October 2013
Karma:
|
Senior Member |
|
|
On Sat, 3 May 2014 13:25:10 -0400, richard wrote:
> I am building an array by scannning ten directories.
> With each scanned directory, the output is stored in one array.
> How do I properly join that array with a second array?
>
> Without duplicate keys!
>
> Array_merge works fine but keys are duplicated.
$lo=0;
$hi=0;
for ($i = 59; $i <= 69; $i++) {
$yr="19$i";
echo $i;
echo $yr;
echo "<br>";
$dir='../audio/'.$yr.'/';
$files = scandir($dir);
$number=count($files);
echo $number;
echo "<br>";
sort($files);
$hi=$hi+$number;
echo $hi;
echo "<br>";
for ($x=0;$x<=$number;$x++){echo $files[$x];
$master[$lo]=$files[$x];
$lo=$lo+1;
}
$lo=$hi;
}
for ($x=0;$x<=$hi;$x++){echo $master[$x]."<br>";}
the echos are there primarily to show what the progress is.
they will be removed for final output.
|
|
|