代码
$i = 1;
$a = $i++; // 先赋值,再自增。等价于$a = $i; $i = $i + 1
echo "i = ".$i;
echo "a = ".$a;
$j = 1;
$b = ++$j; // 先自增,再赋值。等价于$j = $j + 1; $b = $j
echo "j = ".$j;
echo "b = ".$b;
输出
i = 2
a = 1
j = 2
b = 2
网友评论