note 68306 deleted from function.sort by googleguy

From: Date: Tue, 22 Oct 2013 06:47:00 +0000
Subject: note 68306 deleted from function.sort by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196639@lists.php.net to get a copy of this message
Note Submitter: memzap at gmail dot com ---- Here is how you would open a file, and put each line into an array. This sorts by the first field $title field. The next thing I would like to figure out is how to do this same sort but with the ability to skip the first word of the title. Like if the title has an "a" or "the" it would skip that portion of the sort. $currentfile = "file.txt"; $fp = fopen( $currentfile, "r" ) or die("Couldn't open $currentfile"); while ( ! feof( $fp ) ) { $line[] = fgets( $fp, 1024 ); foreach ( $line as $newarray ) { } $newline[] = trim($newarray); sort($newline); list($title1, $titleurl1, $rating1) = split ('\|', $newline[0]); list($title2, $titleurl2, $rating2) = split ('\|', $newline[1]); list($title3, $titleurl3, $rating3) = split ('\|', $newline[2]); list($title4, $titleurl4, $rating4) = split ('\|', $newline[3]);

« previous php.notes (#196639) next »