PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
I want to find the maximum and minimum, average value from the text file
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
The values fetched is for the last row and values are not exact....
The values are average and maximum values I have to pass into array
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
sandy1028 wrote:$count= number of lines in the array....
The value is correct.....
If that value is correct then you must be trying to get the average value from all the lines in the file. That's not what the code in your first post tries to do. You code splits a line on ":", then takes one of the fields and splits it on " ", then adds all the values from that together. For example:
You're adding up 1 2 3 4. I assumed that was what you want to do. Hence my code returns the min, max and average values from that array, it does not use the number of lines in the file.
I think you need to explain exactly what you're trying to do.