0

さて、連想配列にデータを追加する方法を理解しようとしています。配列は次のようになります。

Array
(
    [games] => Array
       [game] => Array
          [0] => Array
             [appID] => 12345
             [logo] => 'http://www.example.com/logo_12345.jpg'
             [name] => 'Game One'
          [1] => Array
             [appID] => 12346
             [logo] => 'http://www.example.com/logo_12346.jpg'
             [name] => 'Game Two'
          [2] => Array
             [appID] => 12347
             [logo] => 'http://www.example.com/logo_12347.jpg'
             [name] => 'Game Three'
    [userID] => 784523569852145
    [username] => 'Gamertag'
)

私がやりたいのは、配列をループして、次の要素を追加して、次のようにすることです。

   Array
    (
        [games] => Array
           [game] => Array
              [0] => Array
                 [appID] => 12345
                 [logo] => 'http://www.example.com/logo_12345.jpg'
                 [name] => 'Game One'
                 [status] => 'active'
              [1] => Array
                 [appID] => 12346
                 [logo] => 'http://www.example.com/logo_12346.jpg'
                 [name] => 'Game Two'
                 [status] => 'active'
              [2] => Array
                 [appID] => 12347
                 [logo] => 'http://www.example.com/logo_12347.jpg'
                 [name] => 'Game Three'
                 [status] => 'active'
        [userID] => 784523569852145
        [username] => 'Gamertag'
    )
4

3 に答える 3