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

WBOY
Release: 2016-06-13 12:35:13
Original
956 people have browsed it

【求指教】为什么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
Copy after login


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

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!