RE: [PHP] URGENT HELP WITH PERL CODE, PLEASE !!!!
| From: | Christensen, BruceX R | Date: | Wed, 09 Aug 2000 18:08:55 +0000 |
| Subject: | RE: [PHP] URGENT HELP WITH PERL CODE, PLEASE !!!! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-10970@lists.php.net to get a copy of this message | ||
I finally understand what you're after :).
Here it is (PHP4):
$categAlpha = $categName;
asort ($categAlpha);
$categAlpha = array_keys($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 10:58 AM
To: php-general@lists.php.net
Subject: [PHP] URGENT HELP WITH PERL CODE, PLEASE !!!!
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net