-4

次の2つの配列があります。

[BA] => Array
    (
        [0] => Array
            (
                [num] => 55
                [val] => 1
            )

        [1] => Array
            (
                [num] => 41
                [val] => 5
            )

        [2] => Array
            (
                [num] => 65
                [val] => 27
            )

        [3] => Array
            (
                [num] => 60
                [val] => 28
            )

        [4] => Array
            (
                [num] => 70
                [val] => 90
            )

        [5] => Array
            (
                [num] => 78
                [val] => 113
            )

        [6] => Array
            (
                [num] => 85
                [val] => 119
            )

    )



[GE] => Array
    (
        [0] => Array
            (
                [num] => 76
                [val] => 1
            )

        [1] => Array
            (
                [num] => 26
                [val] => 6
            )

        [2] => Array
            (
                [num] => 69
                [val] => 11
            )

        [3] => Array
            (
                [num] => 64
                [val] => 48
            )

        [4] => Array
            (
                [num] => 9
                [val] => 85
            )

        [5] => Array
            (
                [num] => 36
                [val] => 112
            )

        [6] => Array
            (
                [num] => 90
                [val] => 127
            )

    )

上記の 2 つの配列の両方を「val」で降順に並べ替え、次のように 1 つの配列にマージする必要があります。

 [new] => Array
        (
            [0] => Array
                (
                    [ruota] => 'GE'
                    [num] => 90
                    [val] => 127
                )

            [1] => Array
                (
                    [ruota] => 'BA'
                    [num] => 85
                    [val] => 119
                )

            [2] => Array
                (
                    [ruota] => 'BA'
                    [num] => 78
                    [val] => 113
                )

            [3] => Array
                (
                    [ruota] => 'GE'
                    [num] => 36
                    [val] => 112
                )

            [4] => Array
                (
                    [ruota] => 'BA'
                    [num] => 70
                    [val] => 90
                )

            [5] => Array
                (
                    [ruota] => 'GE'
                    [num] => 9
                    [val] => 85
                )

            [6] => Array
                (
                    [ruota] => 'GE'
                    [num] => 64
                    [val] => 48
                )

        )

誰か助けてくれませんか?事前にどうもありがとうございました!:)

4

2 に答える 2