LoginSignup
2
2

More than 5 years have passed since last update.

phpで配列と配列を比較する

Last updated at Posted at 2017-04-30

phpで配列と配列を比較する時、2つの配列が同じであることを判定する場合は等価演算子が使えます。

    $array1 = [
        'userId' => 1,
        'userName' => 'Yamada',
        'createDate' => 20170501101532,
    ];
    $array2 = [
        'userId' => '1',
        'userName' => 'Yamada',
        'createDate' => '20170501101532',
    ];

    var_dump($array1 == $array2);  // 型判定なし true
    var_dump($array1 === $array2); // 型判定あり false
2
2
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
2
2