[ create a new paste ] login | about

Link: http://codepad.org/CMf3zr8B    [ raw code | output | fork ]

PHP, pasted on May 14:
1
2
3
4
5
6
7
8
9
10
11
12
<?php
$a = array('a' => 1, 'b' => 2, 'c' => 2, 'd' => 2, 'e' => 2, 'f' => 2);
$b = array('a', 'b', 'd');

$c = compare_plus($a, $b);
print_r($c);

function compare_plus($arr, $plusarr){
    foreach($plusarr as $key)
        $arr[$key]++;
    return $arr;
}


Output:
1
2
3
4
5
6
7
8
9
Array
(
    [a] => 2
    [b] => 3
    [c] => 2
    [d] => 3
    [e] => 2
    [f] => 2
)


Create a new paste based on this one


Comments: