$ i ++问题理解 [英] $i++ problem understanding
问题描述
目前我正在学习PHP。
我能理解以下内容:
$ a = 10;
$ b = $ a ++;
打印(" $ a,$ b");
将在屏幕上打印11,10。
因为当$ b = $ a ++时,首先发生的事情是$ b = $ a
然后$ a = $ a + 1.我愿意并且可以接受。
>
但是更难接受的是我没有看到其中的逻辑,
如下:
$ i = 1;
打印($ i ++);
这将打印1,之后只会将$ i的值增加
1.它介于()之间所以逻辑首先告诉我$ i ++然后打印。
任何人都可以帮助我理解这个或看到其中的逻辑吗?
thanx,
Pugi!
Currently I am studying PHP.
I can understand the following :
$a = 10;
$b = $a++;
print("$a, $b");
will print 11, 10 on the screen.
because when $b = $a++ first thing that happens is $b = $a
and then $a = $a + 1. I am willing to and can accept that.
But much harder to accept is and I fail to see the logic in it,
is the following :
$i = 1;
print($i++);
This will print 1 and only afterward will the value of $i be increased
by 1. It is between (), so logic tells me first $i++ and then print.
Can anyone help me understand this or see the logic in it ?
thanx,
Pugi!
推荐答案
a = 10;
a = 10;
b =
a ++;
print("
a++;
print("
这篇关于$ i ++问题理解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!