P
P
pzverr2014-10-29 13:13:34
PHP
pzverr, 2014-10-29 13:13:34

How to compare the values ​​of two multidimensional associative arrays?

Good afternoon.
There are 2 arrays:

Array
(
    [0] => Array
        (
            [destination] => Адрес 1
            [tel_and_name] => 123/Павел
            [company] => ООО СтройГрупп
            [ttn] => 1
            [sending_letting] => 0
            [other_docs] => 
        )

    [1] => Array
        (
            [destination] => Адрес 2
            [tel_and_name] => 321/Евгений
            [company] => ООО Консалт
            [ttn] => 1
            [sending_letting] => 1
            [other_docs] => 
        )

)

Array
(
    [0] => Array
        (
            [destination] => обновленный адрес 1 
            [tel_and_name] => 456/Павел
            [company] => ООО СтройГрупп
            [ttn] => 1
            [sending_letting] => 0
            [other_docs] => 
        )

    [1] => Array
        (
            [destination] => обновленный адрес 2 
            [tel_and_name] => 654/Евгений
            [company] => ООО Консалт
            [ttn] => 1
            [sending_letting] => 1
            [other_docs] => 
        )

)

I can't figure out how to make the resulting array look like this:
Array
(
    [0] => Array
        (
            [destination_before] => Адрес 1
            [destination_after] => обновленный адрес 1
            [tel_and_name_before] => 123/Павел
            [tel_and_name_after] => 456/Павел
        )

    [1] => Array
        (
            [destination_before] => Адрес 2
            [destination_after] => обновленный адрес 2
            [tel_and_name_before] => 321/Евгений
            [tel_and_name_after] => 654/Евгений
        )

)

I tried using array_diff_assoc but this option is suitable if the arrays would be one-dimensional.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tuxx, 2014-10-29
@tuxx

I think this will help you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question