LoginSignup
1
0

【PHP】条件式「==」と「===」の違い

Posted at

意味

  • 「==」
    値のみ比較する。型定義までは比較しない

  • 「===」
    値と型定義まで含めた完全一致か不完全一致かを判定する。

速度

  • 「===」の方が早い
    • 「==」は型変換してから比較という順番になるため、大規模なデータを扱うと、速度に差が出てくる。

まとめ

  • 条件式を使う際は、「===」を使用した方が安全な作りになる。速度も早い
1
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
1
0