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: how to join two arrays? [message #185717 is a reply to message #185716] Sun, 04 May 2014 20:48 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 3:47 PM, Thomas 'PointedEars' Lahn wrote:
> Jerry Stuckle wrote:
>
>> On 5/4/2014 1:56 PM, Thomas 'PointedEars' Lahn wrote:
>>> Denis McMahon wrote:
>>>> then: array_merge ( $arr1, $arr2 );
>>>>
>>>> will generate:
>>>>
>>>> [0] "."
>>>> [1] ".."
>>>> [2] "foo.bar"
>>>> [3] "really fubar"
>>>> [4] "."
>>>> [5] ".."
>>>> [6] "bah bah.blacksheep"
>>>> [7] "fufu.fubar"
>>>>
>>>> How you then tell which file is where, that's your headache at this
>>>> point.
>>>
>>> array_map() serves here.
>>
>> And how can array_map() tell which file is where?
>
> It cannot.

Then why did you say it could?

However, if you apply array_map() to the arrays returned by
> scandir() before merging them, the problem at hand does not occur in the
> first place:
>
> $modi = max(
> array_map('filemtime',
> array_diff(
> array_merge(
> scandir(__DIR__),
> array_map(
> function ($e) {
> return 'sections' . DIRECTORY_SEPARATOR . $e;
> },
> scandir('sections')
> )
> ),
> array('.', '..')
> )
> )
> );
>
>
> HTH
>
> PointedEars
>

What a convoluted mess. Glad you're not working on any code I have to
touch!

But then you always did have a knack for making a mountain out of a
molehill.

--
==================
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:49:01 GMT 2024

Total time taken to generate the page: 0.04422 seconds