Using php I'd like to subtract/minus two times; each time within a separate document and thereafter have php write the result (Result after subtracting the two times) within another single text document or within a html document with no HTML tags, just text. The two times subtracted will determine how long a certain player has played the game on which this script will be used for. Also, when I state the script must subtract two times, that is actually for one player, therefore in overall there should be more than two times subtracted; depending on how many people actually play the game.
If you take a look at the following below, this is a text file containing a player's user name as well as the local time for a player, followed by other numbers which are irrelevant within this case:
The text file is called "begin.txt":
"AULLAH1" "01/07/2010 15:28 " "55621454" "123456" "123456.00"
"USERNAME" "7/3/2010 6:21 PM" "55621454" "123456" "123456.00"
"AULLAH1" "07/07/2010 15:05 " "55621454" "189450" "123456.00"
"SUPREMEGAMER" "7/8/2010 6:42 PM" "55621454" "123456" "123456.00"
There are two "AULLAH1" user name entries, as this player has played the game twice. The next entry on the first line is "01/07/2010 15:28 " which is the date and current time for the person "AULLAH1". The other data after the date and time are irrelevant, therefore they can be ignored.
Within another text document, titled "end.txt" is the following data, which is in the same format as the previous text file:
"AULLAH1" "01/07/2010 15:54 " "55621454" "123456" "123456.00"
"USERNAME" "7/3/2010 6:49 PM" "55621454" "123456" "123456.00"
"AULLAH1" "07/07/2010 15:32 " "55621454" "189450" "123456.00"
The difference within this text file is that there is no player titled "SUPREMEGAMER" as this player didn't manage to finish the game. Also, the time is different for those users who managed to finish the game. Player "AULLAH1" is also listed twice as this player has finished this game twice.
I'd like the php script to search the end.txt file for the last entry of user name "AULLAH1" and grab the entire line thereafter again, search for the last entry of "AULLAH1" from begin.txt and then subtract the times. Once it's subtracted, I'd like the user name as well as time to be written within another text document or within a html document with no HTML tags, just text (as stated earlier). So, this will only show the time played for the user "AULLAH1" therefore, I'd like this process to be done for each and every user name within the end.txt document.
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. :)