note 68288 added to function.sort
| From: | memzap at gmail dot com | Date: | Thu, 20 Jul 2006 21:24:06 +0000 |
| Subject: | note 68288 added to function.sort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114989@lists.php.net to get a copy of this message | ||
I am having an issue trying to figure out how to sort an array. Here is the issue.
I am trying to put titles of a book into an array and sort by the first field of a flat database
which is the title. When I sort it sorts titles starting with "a" at the top of course,
and "the" at the end where it should be.
I would like to exlude certain words before the sort but have them back on the display of the Title.
I tried to write out code to do this but it seemed to explode into a huge program. I was wondering
if anyone has a simple way of doing this.
while ( ! feof( $fp ) ) {
$m14line[] = fgets( $fp, 1024 );
sort($m14line);
list($m14title1, $m14titleurl1, $m14rating1) = split ('\|', $line[0]);
list($m14title1, $m14titleurl1, $m14rating1) = split ('\|', $line[1]);
list($m14title1, $m14titleurl1, $m14rating1) = split ('\|', $line[2]);
list($m14title1, $m14titleurl1, $m14rating1) = split ('\|', $line[3]);
}
?>
This is a sample of the display code I currently have. This doesn't do anything special other
than pull the array in and sort by the first word of the Title. I am looking to skip any words that
I choose to skip, like for instance the word "the" in all cases.
Thanks for any help in advance.
----
Server IP: 216.194.113.175
Probable Submitter: 67.176.38.16
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.sort.php
Edit -- http://master.php.net/note/edit/68288
Del: integrated -- http://master.php.net/note/delete/68288/integrated
Del: useless -- http://master.php.net/note/delete/68288/useless
Del: bad code -- http://master.php.net/note/delete/68288/bad+code
Del: spam -- http://master.php.net/note/delete/68288/spam
Del: non-english -- http://master.php.net/note/delete/68288/non-english
Del: in docs -- http://master.php.net/note/delete/68288/in+docs
Del: other reasons-- http://master.php.net/note/delete/68288
Reject -- http://master.php.net/note/reject/68288
Search -- http://master.php.net/manage/user-notes.php