troubleshooting Question

php array diff

Avatar of Insoftservice
InsoftserviceFlag for India asked on
PHP
9 Comments3 Solutions388 ViewsLast Modified:
hi,
i have two array on coming from db and other from xml.

i have to merge it keeping in mind the order and its data.
as per order 'Array 1' has to be kept in higher order, but if its present in 'Array 2' then it's order has to be maintain accordingly and data has to be merge with 'Array 2' over here its for 'muk'

Array 1
Array
(
    [vinay] => Array
        (
            [payment_date] => 0
            [dnname] => vinay
            [dnprivate] =>
            [wbcrstmps] => 911789
            [dnforward] => 495232
            [dndoa] => 1337625000
            [dndoe] => 1337625000
        )

    [muk] => Array
        (
            [payment_date] => 0
            [dnname] => muk
            [dnprivate] =>
            [wbcrstmps] => 911789
            [dnforward] => 495232
            [dndoa] => 1337625000
            [dndoe] => 1337625000
        )
)
Array 2
Array
(
    [dxvdf.in] => Array
        (
            [emadminid] => no_email
            [wbcrstmps] => 911793
            [emtotid] => 5
            [WBRFNBR] => Array
                (
                    [EML] => 911793
                    [DOM] => 911793
                    [MOB] => 911793
                )
      )

      [muk] => Array
        (
            [emadminid] => muk
            [wbcrstmps] => 911793
            [emtotid] => 5
            [WBRFNBR] => Array
                (
                    [EML] => 911793
                    [DOM] => 911793
                    [MOB] => 911793
                )
      )
)


o/p

Array
(
    [dxvdf.in] => Array
        (
            [emadminid] => no_email
            [wbcrstmps] => 911793
            [emtotid] => 5
            [WBRFNBR] => Array
                (
                    [EML] => 911793
                    [DOM] => 911793
                    [MOB] => 911793
                )
      )

    [vinay] => Array
        (
            [payment_date] => 0
            [dnname] => vinay
            [dnprivate] =>
            [wbcrstmps] => 911789
            [dnforward] => 495232
            [dndoa] => 1337625000
            [dndoe] => 1337625000
        )

    [muk] => Array
        (
            [payment_date] => 0
            [dnname] => muk
            [dnprivate] =>
            [wbcrstmps] => 911789
            [dnforward] => 495232
            [dndoa] => 1337625000
            [dndoe] => 1337625000
          [emadminid] => muk
            [emtotid] => 5
            [WBRFNBR] => Array
                (
                    [EML] => 911793
                    [DOM] => 911793
                    [MOB] => 911793
                )
        )

      
)
ASKER CERTIFIED SOLUTION
StingRaY

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros