Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.php Subject: Re: how to join two arrays? Date: Sun, 04 May 2014 21:47:08 +0200 Organization: PointedEars Software (PES) Lines: 54 Message-ID: <4250025.snfbUPKjyN@PointedEars.de> References: <1ma4780alja8r$.a7gtdehqwehf$.dlg@40tude.net> <7972885.Ly6agpYKli@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: solani.org 1399232843 17594 eJwFwQkBwDAIA0BL0IVnciAF/xJ6Z5+rM+DmsLU9xNDvlHUu4zYoW/N3rJ++QiGAVc3RyrAHRikSGw== (4 May 2014 19:47:23 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sun, 4 May 2014 19:47:23 +0000 (UTC) User-Agent: KNode/4.12.4 X-User-ID: eJwFwQkBACAIBLBKfIcQBxT6R3CDOvs95nDDYlMmiprFTR5RHgytsSZPJDqqMCh7dndXuYMeLUdXkvqR+T0FFSs= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. 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. 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 -- Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. -- Tim Berners-Lee