RE: Perl to PHP code tranlation URGENT !
| From: | Javier Leyba | Date: | Wed, 09 Aug 2000 15:47:03 +0000 |
| Subject: | RE: Perl to PHP code tranlation URGENT ! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10948@lists.php.net to get a copy of this message | ||
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