国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP basic syntax: self-increment and self-decrement

Self-adding and self-subtracting operations

Self-adding and self-subtracting means adding 1 to yourself or subtracting 1 from yourself.
If you have studied other programming languages. You will find that the usage here is another rule in the computer. It can be used like this, which makes it more concise.

##$x++First Add #$x after assignment--Assign value first and then subtract++$x Add first and then assign value--$xDecrease first and then assign value
SymbolDescription
The above usage is actually quite simple Yes, follow the example above. We divide it into steps and judge according to the process.

<?php


$x = 5;
//先賦值后加:即先將$x的值賦值給$y。$x的值為5,所以將$x的值賦值給$y。$y也為5
$y = $x++;
//$x的結(jié)果輸出為6,因?yàn)橘x值給$y后,$x自己又把自己進(jìn)行了+1操作。所以,$x的結(jié)果為6
echo $x;
?>

Let’s compare adding first and then assigning value, as follows:

<?php

$x = 5;
//先將$x自加1,$x等于5,自加1后結(jié)果為6。因此,$y的結(jié)果為6
//自加后,再將結(jié)果6偷偷的賦值給自己$x
$y = ++$x;
//$x的結(jié)果輸出也為6。因?yàn)?x執(zhí)行+1完成后,將5+1的結(jié)果賦值給了自己
echo $x;
?>

You can do another experiment and try $x-- and --$x. Is this the result?

Please answer, what is the result of $water + $paper below?

<?php

$x = 5;
$y = 6;

$foo = $x++ + $x--;
$bar = ++$y + ++$x;
$cup = $x-- + $y--;
$paper = ++$x + $x++;
$water = $y-- + $x--;

echo $water + $paper;
?>


Continuing Learning
||
<?php $x = 5; $y = 6; $foo = $x++ + $x--; $bar = ++$y + ++$x; $cup = $x-- + $y--; $paper = ++$x + $x++; $water = $y-- + $x--; echo $water + $paper; ?>
submitReset Code