cbastian-hill
asked on
PHP remove duplicate values from multidimensional array
I'm trying to figure out how to merge duplicate array entries, in a multidimensional array.
Here's an excerpt of my data:
What I'm trying to do is find anywhere that the text is the same, and merge them into a single key=>value pair. But aside from just merging the text, the numbers need to be added (and averaged) together to create a new number.
Ideally the above snip would become the following snip:
The new number (88.095) created by the following = ((90.48+85.71)/2).
Anyone have any ideas? I have been trying to get this all day, but I can't seem to find any info that helps or figure it out myself... Thanks for any assistance in this...
Here's an excerpt of my data:
Accounting/Business - 86.02
1->Demonstrate analytical and critical-thinking skills with direct application to business environments. => 85.71
2->Communicate ideas and information effectively both orally and in writing. => 90.48
3->Demonstrate skill in the use of computer software application and technology in business and industry. => 90.48
4->Demonstrate skill in the use of computer software application and technology in business and industry. => 85.71
What I'm trying to do is find anywhere that the text is the same, and merge them into a single key=>value pair. But aside from just merging the text, the numbers need to be added (and averaged) together to create a new number.
Ideally the above snip would become the following snip:
Accounting/Business - 86.02
1->Demonstrate analytical and critical-thinking skills with direct application to business environments. => 85.71
2->Communicate ideas and information effectively both orally and in writing. => 90.48
3->Demonstrate skill in the use of computer software application and technology in business and industry. => 88.095
The new number (88.095) created by the following = ((90.48+85.71)/2).
Anyone have any ideas? I have been trying to get this all day, but I can't seem to find any info that helps or figure it out myself... Thanks for any assistance in this...
Afterthought... Please use echo "<pre>"; before the var_dump() - it makes the output much more readable. And please present a fairly large excerpt (perhaps all the data) so we do not overlook the outliers in the test cases.
Best, ~Ray
Best, ~Ray
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks... I wasn't really thinking... Following your tip with a slight change, I got it to work... Thanks!
thanks, ~Ray