Page 1 of 1

files

Posted: Thu Aug 02, 2007 12:46 am
by sandy1028
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

How to sort the text_line[0] and $text_line[1]
When I explode it is : and again i have exploded using space,
How do I get the sorted values for text_line[0] and $text_line[1]

Code: Select all

$lines = file('file.txt');
foreach($lines as $line)
{
        $text_line=explode(":",$line);
        $text=explode(" ",$text_line[0]);
         sort($text);
}
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Aug 02, 2007 10:48 am
by Chalks
Depending on how you want to sort, this may help:
Array functions