Home > Backend Development > PHP Tutorial > 0408 learning--increase and decrease rhts 040 tomn 040 mide 04

0408 learning--increase and decrease rhts 040 tomn 040 mide 04

WBOY
Release: 2016-07-29 08:54:21
Original
6919 people have browsed it
Increment operator and decrement operator
$a = 10;
$a++;
echo $a;

The above $a is the output item, so assign the value first and then perform the operation

$a has a value of 11

------------------------------------------------ -----------------------
echo "
";
$e = 10;
--$e;
echo $e;

$e above is the output item, so it needs to be calculated first and then assigned.

$e value is 9

------------------------------------------------ -----------------------
echo "
";
$b = 10;
$x = $b++ + ++$b;
echo $b." ";
echo $x;
The above ($b + 1) plus (+1 of $b)
++$b is calculated first and then used

At this time, the The value of a $b is 10; the corresponding second value of

is 12

------------------------- ----------------------------------
echo "
";
$c = 10;
$z = $c++ + $c++;
echo $c." ";
echo $z;

The above $c++ is used first and then operated

At this time, the value of the first $c is 10;

The second value is 12

---------------------------------- --------------------------

The above introduces the 0408 learning - self-increasing and self-decreasing, including the content of 040,408. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template