Weight averages with range max
<p>I have 4 arrays. Each array has items that have a numerical values and max value of range. Also each item has a weight. I want to get a total score out of 100 for each array and all 4 arrays together. Below is an example of one of the arrays. The other arrays are identical. Also, each array will have a weight, and will determine the percentage of the total score. How do I get a score/100 for each array and a total score/100.</p>

<pre><code>$total_score = 0;

$array_one_weight = 10;
$array_two_weight = 10;
$array_three_weight = 20;
$array_four_weight = 20;

$array_one_score = 0;
$array_two_score = 0;
$array_three_score = 0;
$array_four_score = 0;

ie

 Array (
     [0] =&gt; Array
         (
                    [score] =&gt; Array
                         (
                             [results] =&gt; Array
                                 (
                                    [slug] =&gt; 'item1'
                                     [weight] =&gt; 10
                                     [value] =&gt; 5.449784191097
                                    [range] =&gt; 10 
                                 )

                         )

        )

     [1] =&gt; Array
         (
                     [score] =&gt; Array
                         (
                             [results] =&gt; Array
                                 (
                                     [slug] =&gt; 'item2'
                                     [weight] =&gt; 20

                          [value] =&gt; 45.3333333
                                        [range] =&gt; 100
                                    )

                            )

            )
    [2] =&gt; Array
            (
                        [score] =&gt; Array
                            (
                                [results] =&gt; Array
                                    (
                                        [slug] =&gt; 'item3'
                                        [weight] =&gt; 20
                                        [value] =&gt; 6
                                        [range] =&gt; 10
                                    )

                            )

            )
    [3] =&gt; Array
            (
                        [score] =&gt; Array
                            (
                                [results] =&gt; Array
                                    (
                                        [slug] =&gt; 'item4'
                                        [weight] =&gt; 30
                                        [value] =&gt; 11.1
                                        [range] =&gt; 50
                                    )

                            )

            )
</code></pre>
