views:

28

answers:

1

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?

A: 
array_map(function($a,$b){
    $a['ga:pageviews'] = ($b['ga:pageviews']/$a['ga:pageviews'])*100;
    return $a;),
 $array1,$array2);
Wrikken