Bug #73672 [Opn->Nab]: 正则表达式运算顺序疑问

From: Date: Wed, 07 Dec 2016 09:15:20 +0000
Subject: Bug #73672 [Opn->Nab]: 正则表达式运算顺序疑问
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205817@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73672&edit=1 ID: 73672 Updated by: laruence@php.net Reported by: jay_medivh at foxmail dot com Summary: 正则表达式运算顺序疑问 -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: windows PHP Version: 7.0.14RC1 Block user comment: N Private report: N New Comment: 这是是历史遗留问题, 结合性不同, PHP的是左结合, 而Java是右结合. 可以参考: http://stackoverflow.com/questions/20559150/ternary-operator-left-associativity thanks Previous Comments: ------------------------------------------------------------------------ [2016-12-07 06:37:09] jay_medivh at foxmail dot com Description: ------------ 这里有一段程序中的代码 var_dump(18130300 == 18130300 ? "hello world" : 18130300 ? 1 : 2); 如上代码在Java和C#中运行结果为hello world , 但是在php中变成了后边的1,我有疑问,这是php特定的运算顺序的确与Java和C#不同还是其他原因 Test script: --------------- <?php var_dump(18130300 == 18130300 ? "hello world" : 18130300 ? 1 : 2); Expected result: ---------------- hello world Actual result: -------------- 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73672&edit=1

« previous php.bugs (#205817) next »