URGENT HELP WITH PERL CODE, PLEASE !!!!
| From: | Javier Leyba | Date: | Wed, 09 Aug 2000 17:57:55 +0000 |
| Subject: | URGENT HELP WITH PERL CODE, PLEASE !!!! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-10968@lists.php.net to get a copy of this message | ||
Hi All !
Please HELPPPPP !!!
I'm translating a Perl code to a PHP code and I 've and array of names (extracted froma
MySQL database) something like this:
$categName[0] = "Ziggy";
$categName[1] = "Andy";
$categName[2] = "Ian";
$categName[3] = "Peter";
....
The Perl code call a sort function on this way:
$categAlpha = sort { $categName[$a] cmp categName[$b] } (0..$#categname);
and I get the following:
$categAlpha[0] = 1;
$categAlpha[1] = 2;
$categAlpha[2] = 3;
$categAlpha[3] = 0;
As you can see the perl sort function make a sort on the categName array by name and return and
ordered array of the original ID's on the cateAlpha array.
I could not found a PHP function capable of do the some.
Could somebody help me ?
Thanks,
Javier