FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » how to join two arrays?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: solved [message #185726 is a reply to message #185724] Mon, 05 May 2014 02:27 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 5/4/2014 10:00 PM, richard wrote:
> On Sun, 4 May 2014 19:54:32 -0400, richard wrote:
>
>> 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.
>
> Questio I have now is, how do I get it so the leading "." and ".." are not
> in the final array?
> I tried using a conditional with !="." and that did not work.
>

Richard,

If written correctly a conditional for !="." would get rid of the '.'
entry; !=".." would get rid of the ".." entry.

But you didn't show your entire code, so it's hard to say what could be
wrong.


--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: count() problem
Next Topic: part two same issue - unwanted empty values in array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 21:57:22 GMT 2024

Total time taken to generate the page: 0.03831 seconds