[PHP] No Idea - Comparing Lines

2003-01-06 Thread Christopher J. Crane
Ok, this is the first time I will post a message without a line of code. I am not sure how to go about this task. So I will describe it and maybe someone will have some thoughts. I use PHP to connect to our many routers and get data using snmp. I have written a script that refreshes itself every

Re: [PHP] No Idea - Comparing Lines

2003-01-06 Thread Petre Agenbag
When you read the first line, split the data into it's components , then assign each value to a variable. Call them: $octet_1,$unix_time_1 etc. Now, start the loop. Inside the loop, read the next line, assign to $octet_2, $unix_time_2 etc. Do your calculations ( $answer = $octet_2 - $octet_1 etc.

Re: [PHP] No Idea - Comparing Lines

2003-01-06 Thread Christopher J. Crane
Thank you, I am going to try this now. Petre Agenbag [EMAIL PROTECTED] wrote in message 1041861992.1993.36.camel@DELL">news:1041861992.1993.36.camel@DELL... When you read the first line, split the data into it's components , then assign each value to a variable. Call them:

Re: [PHP] No Idea - Comparing Lines

2003-01-06 Thread Christopher J. Crane
Ok here is what I did but it does not do anything. I verified that is opening the file ok and everything, but it shows nothing. It doesn't even produce an error. I am sure there is an easier way than looping twice, but this is how I have it for now. $Lines = array(); $TempDir = tempdata;

Re: [PHP] No Idea - Comparing Lines

2003-01-06 Thread Jason Wong
On Tuesday 07 January 2003 01:12, Christopher J. Crane wrote: Ok here is what I did but it does not do anything. I verified that is opening the file ok and everything, but it shows nothing. It doesn't even produce an error. I am sure there is an easier way than looping twice, but this is how I

RE: [PHP] No Idea - Comparing Lines

2003-01-06 Thread Ford, Mike [LSS]
-Original Message- From: Christopher J. Crane [mailto:[EMAIL PROTECTED]] Sent: 06 January 2003 17:12 Ok here is what I did but it does not do anything. I verified that is opening the file ok and everything, but it shows nothing. It doesn't even produce an error. I am sure there

Re: [PHP] No Idea - Comparing Lines

2003-01-06 Thread Marco Tabini
Hi Chris-- Try this: ?php $lines = file ('test.txt'); $i = 0; while ($i count ($lines)) { preg_replace ('/([^|]*):([^|]*)|/e', '$data[$1] = $2', $lines[$i]); if ($i 0) { $kbitsout = float) $data['OctetsOut'] - $olddata['OctetsOut']) /