Help sorting words on files

im doing a script that will sort all word on a file
but im having some troubles
how can i store the words from the file on an array and then
after sorting them passing it back to the file
or just sort it from the file directly
if anyone can it would really help me out
thanks

each line on the file has just one word its sorta like a word list.

Never mind guys i got it :D
This is how i got it to work

if (isset($_POST['sort'])){
   $words = file($filename);
   sort($words);
   file_put_contents ($filename, $words);
} 
Sponsor our Newsletter | Privacy Policy | Terms of Service