0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PHP 三項演算子

Posted at

目的

  • 三項演算子の概要をまとめる

書き方の例

  • 下記に三項演算子の例を記載する。
$変数 = (条件式) ? 真の時変数に格納する値 : 偽の時変数に格納する値;
  • 下記に前述の三項演算子をif文で書く例を記載する。
if (条件式) {
  $変数 = 真の時変数に格納する値;
} else {
  $変数 = 偽の時変数に格納する値;
}
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?