Jump to content

[SOLVED] Remove timestamps from an array


soadlink

Recommended Posts

Hello,

 

I have a script that does some logging to a .rtf file, and in the logs it adds timestamps and creates a new line "\n". So I end up with a bunch of lines like so:

 

word1 (Sun Feb 11th, 2007 04:45 am)

word2 (Sun Feb 11th, 2007 04:46 am)

word3 (Sun Feb 11th, 2007 04:47 am)

word4 (Sun Feb 11th, 2007 04:48 am)

 

I realized now that for what I'm doing this wasn't a very good idea to log the timestamps because they aren't important, and need to remove the timestamps. There are hundreds of lines per log, and many logs, so editing it manually would take a long time. The days, dates, times, etc.. are all different and are not in any order like in my example.

 

I am looking for a way to load the log file as an array, and remove all the timestamps, and output the result as a new array. So for my example the new array would be:

 

word1

word2

word3

word4

 

If there is a way to remove the everything in between the (), that would work too because none of the 'words' will have () in them, so there would be no conflicts. Or if you guys know a quicker way than using a php script let me know  8) Thanks for the help!

Link to comment
https://forums.phpfreaks.com/topic/38440-solved-remove-timestamps-from-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.