|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-08-30 08:17 UTC] wwwgying at qq dot com
Description: ------------ <?php $a=1; $c=$a+$a+$a++; var_dump($c); $a=1; $c=$a+$a++; var_dump($c); ?> we will get int(3) int(3) and the same code,php result is not the same with other program languages. Test script: --------------- <?php $a=1; $c=$a+$a+$a++; var_dump($c); $a=1; $c=$a+$a++; var_dump($c); ?> Expected result: ---------------- int(3) int(3) Actual result: -------------- int(3) int(2) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 20:00:02 2025 UTC |
And who tells the program gives int(3) int(3)? I just wrote a program in C which gave me 3 and 2, #include <stdio.h> int main() { int a, c; a=1; c=a+a+a++; printf("%d\n",c); a=1; c=a+a++; printf("%d", c); } This program prints 3 2 not 3 3