|
-
May 22nd, 2005, 12:00 PM
#1
Thread Starter
Fanatic Member
Average of values in a string? [Resolved]
Hello all,
I came across a problem with calc an average, the thing is, i have a big string, full of values separated using ; and ,
Let me show:
$myString="1,2;2,2;1,3;2,3;2,4";
The average of that should return something like:
(1+2+1+2+2)/5
and
(2+2+3+3+4)/5
That string has 2 answers for 1 question, that would do 2 averages, not just one in this case.
Answer 1 would be 1,6
Answer 2 would be 2,8
The answers schema is: <answer1>,<answer2>;<answer1>,<answer2>;...
But it can be <answer1>,<answer2><answer3>;<answer1>,<answer2><answer3>;...
or
<answer1>;<answer1>;<answer1>;...
Does anyone have any idea on how to solve this?
Last edited by TDQWERTY; May 28th, 2005 at 02:02 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|