gpt4 book ai didi

php - 缩短 if 语句的最有效方法

转载 作者:可可西里 更新时间:2023-10-31 23:58:04 29 4
gpt4 key购买 nike

如果代码如下,如何缩短 if 语句?

$a = null;
$b = "foo";

if ((empty($a) && !empty($b)) || (!empty($a) && empty($b)) {}

最佳答案

$a = null;
$b = "foo";
if(empty($a) xor empty($b)){}

关于php - 缩短 if 语句的最有效方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50212279/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com