Home  >  Article  >  Backend Development  >  【求赐教】为什么PHP的这2个加法运算结果为什么都是3

【求赐教】为什么PHP的这2个加法运算结果为什么都是3

WBOY
WBOYOriginal
2016-06-13 12:35:13985browse

【求指教】为什么PHP的这2个加法运算结果为什么都是3?

<?php <br />
$a = 1;<br />
$c = $a+$a++;<br />
var_dump($c); // result:3<br />
<br />
$a = 1;<br />
$c = $a+$a+$a++;<br />
var_dump($c); //result:3


我的理解:第一个结果应该是2,第二个结果应该是3
打印输出:
int 3<br />
int 3

Statement:
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