php3-list | 199901
Date: 01/04/99
- Next message: Andrew Chen: "Re: [PHP3] Sorting multiple arrays"
- Previous message: El Jeffo: "[PHP3] version question"
- In reply to: Casper Scheffer: "[PHP3] Sorting multiple arrays"
- Next in thread: Andrew Chen: "Re: [PHP3] Sorting multiple arrays"
- Reply: Andrew Chen: "Re: [PHP3] Sorting multiple arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I haven't looked at PHP in a little bit, so though the syntax will be
wrong, the ideas will be right. I think you can create associative arrays
(otherwise known as hashes) in PHP3 through:
$val = ("berlin"=>"bier",
"amsterdam"=>"dope",
"paris"=>"wine",
"brussels"=>"food");
"berlin" would be the key, and "bier" is the value. The idea is that
you can get a value by using the key, for example:
$val{"berlin"} evaluates to "bier" -- the syntax is probably wrong, so
make sure you check.
Anyway, if you look in the array section of the manual, there is a
specific function to do this... a quick glance yields usort() as a
candidate. I could be wrong-- check it out.
Andrew
On Mon, 4 Jan 1999, Casper Scheffer wrote:
> Hello,
>
> Can anyone give me some help how to sort a multiple array:
>
> f.i.
>
> $val[0][0] = 'berlin' $val[0][1] = 'bier'
> $val[1][0] = 'amsterdam' $val[1][1] = 'dope'
> $val[2][0] = 'paris' $val[2][1] = 'wine'
> $val[3][0] = 'brussels' $val[3][1] = 'food'
>
> How do I sort this list on the second element?
>
>
> Thanks,
>
> Casper
>
> --
> PHP 3 Mailing List http://www.php.net/
> To unsubscribe send an empty message to php3-unsubscribe <email protected>
> To subscribe to the digest list: php3-digest-subscribe <email protected>
> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3
> List administrator: zeev <email protected>
>
>
>
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev <email protected>
- Next message: Andrew Chen: "Re: [PHP3] Sorting multiple arrays"
- Previous message: El Jeffo: "[PHP3] version question"
- In reply to: Casper Scheffer: "[PHP3] Sorting multiple arrays"
- Next in thread: Andrew Chen: "Re: [PHP3] Sorting multiple arrays"
- Reply: Andrew Chen: "Re: [PHP3] Sorting multiple arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

