三目运算符 结合方向问题

WBOY
Release: 2016-06-23 13:30:57
Original
1643 people have browsed it

代码:
$o=1;
 true?100: (true?($o=100+100):100);
 echo $o;

问题:上面有2个三目运算符 结合方向:左,现在我把后面的加了括号优先级提高了 也就是改变了 结合方向 从右开始运算 ,既然是从右开始运算的 我的$o理论输出的是200哦 为什么,结果输出的是1


回复讨论(解决方案)

奇怪!你这是什么理论?
难道加个括号,儿子就比老子先出生了?

肯定是先执行最外围三目,false
才会执行后面的三目

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template