[ create a new paste ] login | about

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

abbasmhd - PHP, pasted on Dec 14:
<?php

$a = array(
    "brand"=>  "xxx" ,
    "id"=> 19220,
    "lmf_comm"=> 0,
    "lmf_pass"=> 0,
    "period"=> "Mar" ,
    "pma"=> "CEDUNA" ,
    "sf_comm"=>0,
    "sf_pass"=> 34,
    "tf_comm"=> 0,
    "tf_pass"=> 0,
    "year"=>  "2012" ) ;

$b = array(
               
   "brand"=> "xxx",
    "id"=> 19220,
    "lmf_comm"=> "0",
    "lmf_pass"=>  "0",
    "period"=> "Mar",
    "pma"=>  "CEDUNA" ,
    "sf_comm"=>  "0" ,
    "sf_pass"=>  "0" ,
    "tf_comm"=>  "0" ,
    "tf_pass"=>  "0" ,
    "year"=>  "2012" 
    
    ) ;

$c = array_intersect($a, $b);
$c1 = array_diff($a, $b);
$c2 = array_diff_assoc($a, $b);

print_r( $c);

print_r( $c1);
print_r( $c2);
?>


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Array
(
    [brand] => xxx
    [id] => 19220
    [lmf_comm] => 0
    [lmf_pass] => 0
    [period] => Mar
    [pma] => CEDUNA
    [sf_comm] => 0
    [tf_comm] => 0
    [tf_pass] => 0
    [year] => 2012
)
Array
(
    [sf_pass] => 34
)
Array
(
    [sf_pass] => 34
)


Create a new paste based on this one


Comments: