如何用PHP编写此条件?

如何用PHP编写此条件?,php,Php,如何用PHP编写此条件 if $x=0 then $y=$z 如果我正确理解了你的问题,那么就这么简单: <?php if ($x == 0) { $y = $z; } 另一种选择是: $y = ($x == 0 ? $z : {null, or whatever else $y should equal}); 为什么不写一个合适的题目呢?这已经讨论过好几次了。 $y = ($x == 0 ? $z : {null, or whatever else $y should eq

如何用PHP编写此条件

if $x=0 then $y=$z

如果我正确理解了你的问题,那么就这么简单:

<?php
if ($x == 0) {
    $y = $z;
}

另一种选择是:

$y = ($x == 0 ? $z : {null, or whatever else $y should equal});

为什么不写一个合适的题目呢?这已经讨论过好几次了。
$y = ($x == 0 ? $z : {null, or whatever else $y should equal});