Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #13505

Re: how to join two arrays?

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: how to join two arrays?
Date 2014-05-04 16:48 -0400
Organization A noiseless patient Spider
Message-ID <lk691r$9ku$1@dont-email.me> (permalink)
References <1ma4780alja8r$.a7gtdehqwehf$.dlg@40tude.net> <lk3q91$aom$4@dont-email.me> <7972885.Ly6agpYKli@PointedEars.de> <lk63ol$44c$1@dont-email.me> <4250025.snfbUPKjyN@PointedEars.de>

Show all headers | View raw


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@attglobal.net
==================

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to join two arrays? richard <noreply@example.com> - 2014-05-03 13:25 -0400
  Re: how to join two arrays? "J.O. Aho" <user@example.net> - 2014-05-03 22:07 +0200
  Re: how to join two arrays? Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-03 22:23 +0000
    Re: how to join two arrays? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-04 19:56 +0200
      Re: how to join two arrays? Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-04 15:17 -0400
        Re: how to join two arrays? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-04 21:47 +0200
          Re: how to join two arrays? Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-04 16:48 -0400
            Re: how to join two arrays? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-04 23:02 +0200
              Re: how to join two arrays? Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-04 17:51 -0400
                Re: how to join two arrays? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-05 00:55 +0200
                Re: how to join two arrays? Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-04 21:31 -0400
                Re: how to join two arrays? Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-04 22:13 -0400
                Re: how to join two arrays? Richard Yates <richard@yatesguitar.com> - 2014-05-05 12:45 -0700
  solved    (was: how to join two arrays?) richard <noreply@example.com> - 2014-05-04 19:54 -0400
    Re: solved richard <noreply@example.com> - 2014-05-04 22:00 -0400
      Re: solved Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-04 22:27 -0400
        Re: solved richard <noreply@example.com> - 2014-05-04 23:07 -0400
          Re: solved Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-05 11:11 +0100
            Re: solved richard <noreply@example.com> - 2014-05-05 09:42 -0400
              Re: solved Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-05 15:51 +0200
              Re: solved Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-05 10:26 -0400
                Re: solved richard <noreply@example.com> - 2014-05-05 10:34 -0400
              Re: solved Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-05-06 00:55 +0000
          Re: solved Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-05 13:36 +0000

csiph-web