RE: Perl to PHP code tranlation URGENT !
| From: | Christensen, BruceX R | Date: | Wed, 09 Aug 2000 16:56:11 +0000 |
| Subject: | RE: Perl to PHP code tranlation URGENT ! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-10956@lists.php.net to get a copy of this message | ||
Sorry! That should be:
$categAlpha = $categName;
sort ($categAlpha);
--Bruce
Bruce Christensen
Intel Corporation
brucex.r.christensen@intel.com
-----Original Message-----
From: Javier Leyba [mailto:jleyba@sabueso.net]
Sent: Wednesday, August 09, 2000 8:47 AM
To: Christensen, BruceX R; php-general@lists.php.net
Subject: RE: Perl to PHP code tranlation URGENT !
On 08/08/2000 at 12:19 p.m. Christensen, BruceX R wrote:
>(For those who aren't familiar Perl, that contorted Perl syntax sorts the
>@categName list elements and stores the result in @categAlpha. The $#
>construct references the number of elements in the @categName array, and
the
>cmp operator performs a custom sort based on each array element value.)
>
>PHP has a built in functions to sort arrays, eliminating the custom sort
>that you do using sort and the cmp operator.
>
>Check the various array sorting functions at
>http://www.php.net/manual/ref.array.php. In your case, you can
>just use
the
>sort() function, so you'd do this:
>
>$categAlpha = sort($categName);
>
Hi
Thanks for your help.
I've dicovered that is not true your example: sort function do not return
any value (void function). Also, Perl sort function return id's of the
source array ordered, but PHP sort function order the source array and that
is not the same I need. Do you know how can I do the same as you saw in my
previous Perl code with PHP ?
Thanks in advance.
Javier