Array comparion for multidimensinal array in php

Posted by Learner on Stack Overflow See other posts from Stack Overflow or by Learner
Published on 2012-12-14T11:01:47Z Indexed on 2012/12/14 11:03 UTC
Read the original article Hit count: 209

Filed under:
|
|
|

Array 1 =>

    pr($plan_data);
    Array
    (
        [0] => Array
            (
                [AveragePrice] => 9.631161
                [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161456
                [EarlyTerminationFee] => 150
                [HurricaneRecovery] => 0.132
                [MeterSurcharge] => 3.05
                [OffCycle] => 5
                [PUCAssessment] => 0.00167
                [PlanDescription] => Savings Champ-6
                [PlanId] => 57
                [PlanIssueDate] => 12/10/2012
                [PlanMonthlyFee] => 0
                [PlanName] => PN1058
                [PlanRate] => 9.3
                [PlanRenewablePercent] => 7.2
                [PlanTerm] => 6
                [PriorityMoveIn] => 36
                [ProviderDisplayName] => CenterPoint Energy
                [ProviderId] => 21
                [ProviderInternalName] => CNP_COAST
                [RateId] => 161456
                [RegularMoveIn] => 16
                [TDSPPassThrough] => 0.03791
                [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161456
                [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF
                [provider] => ces
                [ProductType] => Fixed
                [Rep] => Champion Energy Services
                [Zone] => 77479
            )

        [1] => Array
            (
                [AveragePrice] => 10.1311693
                [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161458
                [EarlyTerminationFee] => 150
                [HurricaneRecovery] => 0.132
                [MeterSurcharge] => 3.05
                [OffCycle] => 5
                [PUCAssessment] => 0.00167
                [PlanDescription] => Savings Champ-12
                [PlanId] => 59
                [PlanIssueDate] => 12/10/2012
                [PlanMonthlyFee] => 0
                [PlanName] => PN1060
                [PlanRate] => 9.8
                [PlanRenewablePercent] => 7.2
                [PlanTerm] => 12
                [PriorityMoveIn] => 36
                [ProviderDisplayName] => CenterPoint Energy
                [ProviderId] => 21
                [ProviderInternalName] => CNP_COAST
                [RateId] => 161458
                [RegularMoveIn] => 16
                [TDSPPassThrough] => 0.03791
                [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161458
                [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF
                [provider] => ces
                [ProductType] => Fixed
                [Rep] => Champion Energy Services
                [Zone] => 77479
            )

        [2] => Array
            (
                [AveragePrice] => 10.4311743
                [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161459
                [EarlyTerminationFee] => 150
                [HurricaneRecovery] => 0.132
                [MeterSurcharge] => 3.05
                [OffCycle] => 5
                [PUCAssessment] => 0.00167
                [PlanDescription] => Green Power-12
                [PlanId] => 60
                [PlanIssueDate] => 12/10/2012
                [PlanMonthlyFee] => 0
                [PlanName] => PN1061
                [PlanRate] => 10.1
                [PlanRenewablePercent] => 100
                [PlanTerm] => 12
                [PriorityMoveIn] => 36
                [ProviderDisplayName] => CenterPoint Energy
                [ProviderId] => 21
                [ProviderInternalName] => CNP_COAST
                [RateId] => 161459
                [RegularMoveIn] => 16
                [TDSPPassThrough] => 0.03791
                [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161459
                [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF
                [provider] => ces
                [ProductType] => Fixed
                [Rep] => Champion Energy Services
                [Zone] => 77479
            )
)

Array 2 =>

pr($temp_val);
Array
(
    [0] => Array
        (
            [id] => 6
            [PlanId] => 60
            [PlanName] => Bounce 12 + A/C Protection
            [PlanDescription] => Bounce 12 + A/C Protection - CNP
            [PlanTerm] => 12
            [PlanRate] => 
            [RateId] => 
            [PlanIssueDate] => 
            [PlanMonthlyFee] => 
            [EarlyTerminationFee] => 200.00000
            [AveragePrice] => 12.00000
            [HurricaneRecovery] => 
            [PlanRenewablePercent] => 
            [ProviderDisplayName] => 
            [ProviderId] => 1
            [provider] => bounce
            [ProductZoneId] => 353
            [Zone] => 77479
            [ProviderInternalName] => 
            [RegularMoveIn] => 
            [PriorityMoveIn] => 
            [OffCycle] => 
            [TDSPPassThrough] => 
            [PUCAssessment] => 
            [EFLUrl] => 
            [EFLLinkUrl] => http://www.bounceenergy.com/efls/bounce12.pdf
            [TOCUrl] => 
            [TOCLUrl] => http://www.bounceenergy.com/terms-of-service-fixed.pdf
            [YRACUrl] => 
            [YRACLUrl] => http://www.bounceenergy.com/yraac.pdf
            [REP_Name] => 
            [REP_PUCT] => 
            [customer_service_email] => 
            [toll_free_number] => 
            [status] => active
            [created] => 2012-12-14 12:40:05
            [modified] => 2012-12-14
        )

    [1] => Array
        (
            [id] => 18
            [PlanId] => 17
            [PlanName] => Online Only - 12
            [PlanDescription] => Online Only - 12
            [PlanTerm] => 12
            [PlanRate] => 
            [RateId] => 386
            [PlanIssueDate] => 
            [PlanMonthlyFee] => 100.00000
            [EarlyTerminationFee] => 175.00000
            [AveragePrice] => 10.00000
            [HurricaneRecovery] => 
            [PlanRenewablePercent] => 
            [ProviderDisplayName] => 
            [ProviderId] => 2
            [provider] => fulcrum
            [ProductZoneId] => 
            [Zone] => 77479
            [ProviderInternalName] => 
            [RegularMoveIn] => 
            [PriorityMoveIn] => 
            [OffCycle] => 
            [TDSPPassThrough] => 
            [PUCAssessment] => 
            [EFLUrl] => 
            [EFLLinkUrl] => 
            [TOCUrl] => 
            [TOCLUrl] => 
            [YRACUrl] => 
            [YRACLUrl] => 
            [REP_Name] => 
            [REP_PUCT] => 
            [customer_service_email] => 
            [toll_free_number] => 
            [status] => active
            [created] => 2012-12-14 12:40:15
            [modified] => 2012-12-14
        )
)

I want to compare this two array and if any key value is different i want to take it an different array..

$result_val= array_diff_assoc($plan_data, $temp_val);

Please help me out !!

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays