Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13508 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20083 invoked by uid 1010); 25 Oct 2004 17:03:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 19886 invoked by uid 1007); 25 Oct 2004 17:03:23 -0000 Message-ID: <20041025170323.19885.qmail@pb1.pair.com> To: internals@lists.php.net References: <417CF662.9080204@naedev.naellia.org> Date: Mon, 25 Oct 2004 19:03:03 +0200 Lines: 44 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Posted-By: 212.238.144.71 Subject: Re: Can *sort functions return the sorted array ? From: r.korving@xit.nl ("Ron Korving") I'm not a fan of this. I don't think it's appropriate to just add parameters to functions all the time just because you don't like the fact that it's call-by-reference. Ron "Fulax" wrote in message news:417CF662.9080204@naedev.naellia.org... > Hi, > > I wonder if it will be possible to add an extra argument to the *sort > functions to get the sorted array directly. > At the moment I have made my own function to do this, here is an example > with natsort : > > function arrnatsort($a_array) > { > if(natsort($a_array)) > return $a_array; > else > return false; > } > > I think it will more convenient to simply call $array = > natsort($array,true);, when you need to combine functions, like this : > $sSortedString = join(',',arrnatsort(explode(',',$sString))); > > At the moment, the way is to create an auxilliary function, or to make > more steps : > > $aTemArray = explode(',',$sString); > natsort($aTempArray); > $sSortedString = join(',',$aTempArray); > unset $aTempArray; > > Does it make sense to add the possibility for an extra argument ? Like > highlight_string function, the extra argument return the string instead > of displaying it. > > Thanks in advance, and sorry for my crapy English > > Cyprien