Re: No Idea - Comparing Lines
| From: | Jason Wong | Date: | Mon, 06 Jan 2003 17:21:09 +0000 |
| Subject: | Re: No Idea - Comparing Lines | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130457@lists.php.net to get a copy of this message | ||
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 have it for now.
>
> $Lines = array();
> $TempDir = "tempdata";
> $DataFromFile = file("$TempDir/$Dat.txt");
> while(list(,$oneline) = each($DataFromFile)) {
> array_push($Lines, $oneline);
> }
> $LineCount = 1;
> while(list(,$oneline) = each($DataFromFile)) {
> $PriorLineCount = $LineCount - 1;
> list($OctetsInB,$OctetsOutB,$TimeB) = split("|", $Lines[$LineCount]);
> list($OctetsInA,$OctetsOutA,$TimeA) = split("|",
> $Lines[$PriorLineCount]); // After much help and work with Harry, this is
> the formula we came up with to show data rates over time.
> // (((Counter_Now - Counter_Before) / (Time_Now - Time_Before(converted
> to seconds))) * 8)) / 1000 = kbits per hour
> $kbitsout = ((($OctetsOutB - $OctetsOutA) / ($TimeB - $TimeA)) * 8 ) /
> 1000;
> print "$kbitsout Kbits - $LineCount<br>\n";
> $LineCount++;
> }
echo() all the variables used and see what you get.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
I'm rated PG-34!!
*/