I am trying to multiple & conditions in if statement in Codeigniter. If I use 2 conditions like below:
#<?php if (trim($var1) == '' & trim($var2) == '') : ?>#
Then it works fine. But if I add another & condition like
#<?php if (trim($var1) == '' & trim($var2) == '') & trim($var23) == ''): ?>#
Then it shows error.
How can I solve it?
Remove this extra bracket,
(trim($var1) == '' && trim($var2) == '') && trim($var23) == ''):
^
Also here you need logical operator &&
and not bit-wise operator &
. Check here to see the difference between them.