Help us understand the problem. What is going on with this article?

php5.4以降は連想配列の定義がラクになった

More than 5 years have passed since last update.

php5.4以降は連想配列の表記が少しラクになりましたよ。
"array"とタイプする必要がなくなったので、タイプ量が減ります。

array.php
<?

/**
 * 古い連想配列表現方法を使った多重配列定義例
 *
 */
$array_old = array(
    array('index' => 1,
          array('hoge' => 'hohoho', 'fuga' => 'fufufu'),
          array('updated_at' => time()),
        ),
    array('index' => 20,
          array('hoge' => 'gegege', 'fuga' => 'gagaga'),
          array('updated_at' => time()),
        ),
    array('index' => 300,
          array('hoge' => 'ohohoh', 'fuga' => 'ufufuf'),
          array('updated_at' => time()),
        ),
    array('index' => 4000,
          array('hoge' => 'egegeg', 'fuga' => 'egegeg'),
          array('updated_at' => time()),
        ),
    );

/**
 * php5.4から採用された新しい連想配列表現方法を使った多重配列定義例
 *
 */
$array_new = [
    ['index' => 1,
     ['hoge' => 'hohoho', 'fuga' => 'fufufu'],
     ['updated_at' => time()],
        ],
    ['index' => 20,
     ['hoge' => 'gegege', 'fuga' => 'gagaga'],
     ['updated_at' => time()],
        ],
    ['index' => 300,
     ['hoge' => 'ohohoh', 'fuga' => 'ufufuf'],
     ['updated_at' => time()],
        ],
    ['index' => 4000,
     ['hoge' => 'egegeg', 'fuga' => 'egegeg'],
     ['updated_at' => time()],
        ],
    ];
}
jun_ya
mewtoneという会社でゲーム向けサーバインフラの設計やサーバプログラム設計やその辺りのコンサルなどをやっていますよ。というかmewtoneという会社のえらい人ですよ。ゲーム系インフラ、サーバプログラムで悩んでいる方はいますぐにアクセスだ(どこへ…)。
http://mewtone.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away