Percentage difference between different values in the same keys of two different arrays.

Posted by Paul on Stack Overflow See other posts from Stack Overflow or by Paul
Published on 2010-06-08T08:16:24Z Indexed on 2010/06/08 8:22 UTC
Read the original article Hit count: 197

Filed under:
|
|

Hey.

I'm looking for a solution to this problem. I got 2 arrays, like this:

    array(2) { 
       [20100526]=>  array(1) { 
           ["ga:pageviews"]=>  string(5) "19088" 
       } 
       [20100527]=>  array(1) {
           ["ga:pageviews"]=>  string(5) "15566" 
       } 
    } 

 array(2) { 
        [20100526]=>  array(1) { 
            ["ga:pageviews"]=>  string(5) "12043" 
        } 
        [20100527]=>  array(1) {
            ["ga:pageviews"]=>  string(5) "11953" 
        } 
    }

Now I'd like to create a new array, with the % difference between the values per key.

Would be something like this:

array(2) { 
            [20100526]=>  array(1) { 
                ["ga:pageviews"]=>  string(5) "88,23" 
            } 
            [20100527]=>  array(1) {
                ["ga:pageviews"]=>  string(5) "74,54" 
            } 
        }

Can anyone help me how to create that array?

© Stack Overflow or respective owner

Related posts about php

Related posts about array