Re: [PHP] sorting and searching an Array

2002-07-17 Thread Kevin Stone

Instead of an indexed array build an associative array and sort with one of
the built-in PHP functions..

$myary = array (
'mrgouldian' => '[EMAIL PROTECTED]',
'myname'=> '[EMAIL PROTECTED]');
ksort($myary);

-Kevin

- Original Message -
From: <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
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
>
> [EMAIL PROTECTED]   mrgouldian
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED]   myname
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] sorting and searching an Array

2002-07-17 Thread rdkurth

 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

[EMAIL PROTECTED]   mrgouldian
[EMAIL PROTECTED]   myname
[EMAIL PROTECTED] mrgouldian
[EMAIL PROTECTED] mrgouldian
[EMAIL PROTECTED]   myname
[EMAIL PROTECTED] mrgouldian
[EMAIL PROTECTED]   myname
[EMAIL PROTECTED]   myname
[EMAIL PROTECTED] mrgouldian
[EMAIL PROTECTED]   myname


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php