0
0

More than 1 year has passed since last update.

PHP:連想配列へキーと値を追加する記法には注意

Posted at

連想配列へキーと値を追加

$arr = array('a' => 1, 'b' => 2, 999 => 3);

#キーと値の追加
記法に注意。配列変数にキーを書いて、その値を右辺から代入する。
微妙に覚えにくい。

$arr['c'] = 3;

var_export($arr);
array (
'a' => 1,
'b' => 2,
999 => 3,
'c' => 3,
)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0