mercredi 25 août 2021

How to use the OR operator in a shorhand if statement in PHP [duplicate]

Hi,

I have this if statement

if($value == 4 || $value == 5 $value == 14) {
 $this = "hi";
}

which is very redundant. Is it possible to have something like this instead:

$this = $value == 4 || 5 || 14 ? "hi" : "";

Thanks.

Aucun commentaire:

Enregistrer un commentaire