Bug #65589 [Com]: PHP Language BUG
Edit report at https://bugs.php.net/bug.php?id=65589edit=1 ID: 65589 Comment by: gautam dot nishchal at gmail dot com Reported by:wwwgying at qq dot com Summary:PHP Language BUG Status: Not a bug Type: Bug Package:Scripting Engine problem Operating System: Windows/Mac/Linux PHP Version:5.5.3 Block user comment: N Private report: N New Comment: I would like to say something to reporter, i think that's a post increment expression which will give int(3) int(3). That's not bug... Previous Comments: [2013-08-30 20:45:11] ahar...@php.net This is undefined behaviour in PHP, as in most languages with C-derived syntaxes. Mailing list discussion from last month: http://marc.info/?t=13742793432r=1w=2 This is also documented, see example 1 on: http://www.php.net/manual/en/language.operators.precedence.php [2013-08-30 08:17:54] 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) -- Edit this bug report at https://bugs.php.net/bug.php?id=65589edit=1
Bug #65589 [Com]: PHP Language BUG
Edit report at https://bugs.php.net/bug.php?id=65589edit=1 ID: 65589 Comment by: gautam dot nishchal at gmail dot com Reported by:wwwgying at qq dot com Summary:PHP Language BUG Status: Not a bug Type: Bug Package:Scripting Engine problem Operating System: Windows/Mac/Linux PHP Version:5.5.3 Block user comment: N Private report: N New Comment: 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 Previous Comments: [2013-10-06 08:35:00] gautam dot nishchal at gmail dot com I would like to say something to reporter, i think that's a post increment expression which will give int(3) int(3). That's not bug... [2013-08-30 20:45:11] ahar...@php.net This is undefined behaviour in PHP, as in most languages with C-derived syntaxes. Mailing list discussion from last month: http://marc.info/?t=13742793432r=1w=2 This is also documented, see example 1 on: http://www.php.net/manual/en/language.operators.precedence.php [2013-08-30 08:17:54] 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) -- Edit this bug report at https://bugs.php.net/bug.php?id=65589edit=1
Bug #65589 [Com]: PHP Language BUG
Edit report at https://bugs.php.net/bug.php?id=65589edit=1 ID: 65589 Comment by: gautam dot nishchal at gmail dot com Reported by:wwwgying at qq dot com Summary:PHP Language BUG Status: Not a bug Type: Bug Package:Scripting Engine problem Operating System: Windows/Mac/Linux PHP Version:5.5.3 Block user comment: N Private report: N New Comment: Expected result is int(3) int(2) I suggest you to read about pre and post increment / decrement :p Previous Comments: [2013-10-06 08:44:47] gautam dot nishchal at gmail dot com 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 [2013-10-06 08:35:00] gautam dot nishchal at gmail dot com I would like to say something to reporter, i think that's a post increment expression which will give int(3) int(3). That's not bug... [2013-08-30 20:45:11] ahar...@php.net This is undefined behaviour in PHP, as in most languages with C-derived syntaxes. Mailing list discussion from last month: http://marc.info/?t=13742793432r=1w=2 This is also documented, see example 1 on: http://www.php.net/manual/en/language.operators.precedence.php [2013-08-30 08:17:54] 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) -- Edit this bug report at https://bugs.php.net/bug.php?id=65589edit=1
Bug #65589 [Com]: PHP Language BUG
Edit report at https://bugs.php.net/bug.php?id=65589edit=1 ID: 65589 Comment by: gautam dot nishchal at gmail dot com Reported by:wwwgying at qq dot com Summary:PHP Language BUG Status: Not a bug Type: Bug Package:Scripting Engine problem Operating System: Windows/Mac/Linux PHP Version:5.5.3 Block user comment: N Private report: N New Comment: Yep, there's a bug, but way of expressing is wrong, expected output is 3,2 but gives you 3,3 Previous Comments: [2013-10-06 08:48:20] gautam dot nishchal at gmail dot com Expected result is int(3) int(2) I suggest you to read about pre and post increment / decrement :p [2013-10-06 08:44:47] gautam dot nishchal at gmail dot com 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 [2013-10-06 08:35:00] gautam dot nishchal at gmail dot com I would like to say something to reporter, i think that's a post increment expression which will give int(3) int(3). That's not bug... [2013-08-30 20:45:11] ahar...@php.net This is undefined behaviour in PHP, as in most languages with C-derived syntaxes. Mailing list discussion from last month: http://marc.info/?t=13742793432r=1w=2 This is also documented, see example 1 on: http://www.php.net/manual/en/language.operators.precedence.php [2013-08-30 08:17:54] 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) -- Edit this bug report at https://bugs.php.net/bug.php?id=65589edit=1