-2

I don't get this operation. Is that a quick if/else statement ?

Inside a HTML : <?= $LU ? $LU : 0 ?>

Directly in PHP : $LU ? $LU : 0

I have no idea what it does

  • 1
    Does this answer your question? [Reference — What does this symbol mean in PHP?](https://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php) – El_Vanja Jan 26 '21 at 15:08
  • It's called a "ternary operator" and yes, it's a short form of `if-else`. – El_Vanja Jan 26 '21 at 15:09

1 Answers1

0

This is called Ternary Operator, you can refer to the documentation.

The expression (expr1) ? (expr2) : (expr3) evaluates to expr2 if expr1 evaluates to true, and expr3 if expr1 evaluates to false.

Kien Nguyen
  • 2,616
  • 2
  • 7
  • 24