Re: sorting and searching an Array
| From: | Kevin Stone | Date: | Wed, 17 Jul 2002 20:31:17 +0000 |
| Subject: | Re: sorting and searching an Array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108156@lists.php.net to get a copy of this message | ||
Instead of an indexed array build an associative array and sort with one of
the built-in PHP functions..
$myary = array (
'mrgouldian' => 'mrgouldian@www.mrgouldian.com',
'myname'=> 'myname@www.mydomain.com');
ksort($myary);
-Kevin
----- Original Message -----
From: <rdkurth@starband.net>
To: "php-general" <php-general@lists.php.net>
Sent: Wednesday, July 17, 2002 1:52 PM
Subject: [PHP] sorting and searching an Array
> After I read this file into an array (small sample of file below) I need
to sorted it by the name at
> the end of each line and then echo out only the ones that the name
> equals the name in a search variable.
>
> Also could somebody recommend a PHP book that covers a lot of info on
> working with text files. It seams to be very little info in any of the
> boos I have now. It is sort of skipped over a lot
>
> mrgouldian@www.mrgouldian.com mrgouldian
> webmaster@www.mydomain.com myname
> info@www.mrgouldian.com mrgouldian
> webmaster@www.mrgouldian.com mrgouldian
> suport@www.mydomain.com myname
> fred@www.mrgouldian.com mrgouldian
> sales@www.mydomain.com myname
> info@www.mydomain.com myname
> gary@www.mrgouldian.com mrgouldian
> myname@www.mydomain.com myname
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>