compare value in 2 multidimension array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all ,

  I have 2 multidimension array as  shown below:
I need to compare all values in the 2 multidimension array where there are any elements values updated or a new elements or be deleted.

Updated mean when value in $temptablearr element is different from value in $currenttablearr element, update status to 'Updated' New mean when value in $temptablearr element is not exists in $currenttablearr , update status to 'New' Deleted mean when value in $currenttablearr element is not exists in $temptablearr elements, update status to 'Deleted'
 If the value are the same in 2 array elements , update status to 'SKIP'

The result of comparing is array of data which "deleted","updated" and "new" except "SKIP" status.

 I have been trying many way to do compare in array unsuccessful.
Anybody have any ideas or suggestions how to solve the issue , your help is much appreciated. Thanks

$temptablearr = array(0 =>
                             array("chassis_serial_no"=>"1235",
                                   "country"=>"Malaysia",
                                   "card_serial_no"=>"cd-12345",
                                   "card_model"=>"ws8950"),
                      1 =>
                             array("chassis_serial_no"=>"1235",
                                   "country"=>"Malaysia",
                                   "card_serial_no"=>"cd-890",
                                   "card_model"=>"ws1234"),
                      2 =>
                             array("chassis_serial_no"=>"8888",
                                   "country"=>"Indonesia",
                                   "card_serial_no"=>"cd-12345",
                                   "card_model"=>"ws999"),
                );


$currenttablearr = array( 0 =>
                             array("chassis_serial_no"=>"1235",
                                   "country"=>"Malaysia",
                                   "card_serial_no"=>"cd-12345",
                                   "card_model"=>"ws8950"),
                          1=>
                             array("chassis_serial_no"=>"1235",
                                   "country"=>"Singapore",
                                   "card_serial_no"=>"cd-890",
                                   "card_model"=>"ws1234"),
                );

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux