标签: php ternary-operator
三元运算符如何在php中工作似乎有点奇怪,有人可以解决这个问题吗?
$z = 'testval'; $x = 'hello ' . isset($z) ? $z : ' notfound'; var_dump($x); //testval
这导致了预期的结果:
$z = 'testval'; $x = 'hello ' . (isset($z) ? $z : ' notfound'); var_dump($x); //returns hello testval