2

次の連想配列があります。

Array
(
    [0] => Array
        (
            [user_id] => 9def02e6337b888d6dbe5617a172c18d
            [user_first_name] => Ashutosh
            [user_last_name] => Modi
            [user_email] => ashutosh.modi@gmail.com
            [user_status] => enable
            [user_subscription] => lifetime
            [user_registered_type] => online
            [user_reg_date] => 1325581397
        )

    [1] => Array
        (
            [user_id] => a6d22e4cc3f65778a60b359842bcec82
            [user_first_name] => Dilip
            [user_last_name] => Modi
            [user_email] => dm.modi@gmail.com
            [user_status] => enable
            [user_subscription] => period
            [user_registered_type] => online
            [user_reg_date] => 1325152066
        )


)

鍵が2つ付いています。今、私は$user_data次の出力を持つ名前の別の配列を持っています:

Array
(
    [user_state] => Rajasthan
    [user_city] => Jhunjhunu
)

このキーと値のペアを上記の配列に追加したいと思います。上記の配列は for ループの最初の反復にすぎないため、上記の値は最初の配列要素に挿入されます。2 番目の配列要素には異なる値が含まれます。次の方法で結果が欲しいです。これを達成するのを手伝ってもらえますか? 前もって感謝します。

Array
    (
        [0] => Array
            (
                [user_id] => 9def02e6337b888d6dbe5617a172c18d
                [user_first_name] => Ashutosh
                [user_last_name] => Modi
                [user_email] => ashutosh.modi@gmail.com
                [user_status] => enable
                [user_subscription] => lifetime
                [user_registered_type] => online
                [user_reg_date] => 1325581397
                [user_state] => Rajasthan
                [user_city] => Jhunjhunu
            )

        [1] => Array
            (
                [user_id] => a6d22e4cc3f65778a60b359842bcec82
                [user_first_name] => Dilip
                [user_last_name] => Modi
                [user_email] => dm.modi@gmail.com
                [user_status] => enable
                [user_subscription] => period
                [user_registered_type] => online
                [user_reg_date] => 1325152066
                 [user_state] => Tamilnadu
                [user_city] => Chennai
            )


    )
4

2 に答える 2