PHP sort text file (.txt) numerically

Lnuuafvlhhivb

New Member
Thank you for taking the time to read this and I will appreciate every single response no mater the quality of content. :)Using php, I'm trying to create a script which will numerically sort a text file (.txt) in ascending order (lowest to highest). Each entry within the text file is on a new line, therefore I'd like the lines to be numerically sorted. If possible, once it has been numerically sorted, I'd like the data to be written into another text file, titled "newtime.txt" within the same directory. Of course, if possible. ;)The main part I'm struggling with is that the content within the text file isn't static (e.g. contain x number of lines/words etc.) Infact, it is automatically updated with several lines. Therefore, I'd like all the lines to be updated numerically.The text file follows the structure:\[code\]2 aullah112 name7 username\[/code\]Of course, which is regularly updated with more lines. Will it be possible to numerically sort the lines? Also, I plan on using a Cron Job to repeat the script every 5 minutes. ;)P.S. What will happen if there are two same numbers? Will it then go onto sorting out the data alphabetically?All assistance is appreciated and I look forward to your replies; thank you. :) If I didn't explain anything clearly and/or you'd like me to explain in more detail, please reply. :)Thank you.
 
Back
Top