samedi 11 avril 2020

Fastest way to check multiple conditions in PHP?

I want to check if three conditions are True. Which of these two options is faster?

1:

if ($var1 AND $var2 AND $var3) { // }

2:

if ($var1) { if ($var2) { if ($var3) { // }}}

I would say they are equally faster because in the first option, if first condition id not True, why check the second? However, in Check multiple variables (boolean) in PHP one user says sequential is faster.

Aucun commentaire:

Enregistrer un commentaire