gpt4 book ai didi

php - 省略三元运算符的第二部分

转载 作者:可可西里 更新时间:2023-10-31 23:05:44 25 4
gpt4 key购买 nike

给定以下表达式:

$att['menutext'] = isset($attrib_in['i_menu_text']) ? : $this->getID();

如果计算结果为真,$att['menutext'] 是否会被设置为 true$this->getID()

最佳答案

根据 this reference :

Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to TRUE, and expr3 otherwise.

关于php - 省略三元运算符的第二部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8099576/

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