简体   繁体   中英

php if this then that AND that

Is there a way in php to write if $a equals 1 then $b is 2 and $c is 3?

if ($a == 1) $b=2 AND $c=3;

doesn't work. Or do I need to write all three of them separately?

不要使用AND并将其与其他语句分开

if ($a == 1) {$b=2; $c=3;}

Your have a syntax problem there. But it's possible :

if ($a == 1) {
    $b = 2;
    $c = 3;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM