不是说++在后的事先运算再赋值,运算会影响结果,当++a是先赋值在运算,运算结果不改变么?只是a的值变了?
What is the difference between a++ and ++a? -PHP Chinese website Q&A-What is the difference between a++ and ++a? -PHP Chinese website Q&A
Please watch and learn.
有区别啊,比如var b = 1;a=b++;c=++b;
那运算完之后
a=1;(b先参与运算,将值赋给a,然后自己再加1,所以a为1,b为2)
c=3;(b为2,然后先自己加1,再将值赋给c)
What is the difference between a++ and ++a? -PHP Chinese website Q&A-What is the difference between a++ and ++a? -PHP Chinese website Q&A
Please watch and learn.
有区别啊,比如var b = 1;a=b++;c=++b;
那运算完之后
a=1;(b先参与运算,将值赋给a,然后自己再加1,所以a为1,b为2)
c=3;(b为2,然后先自己加1,再将值赋给c)