Home >> PHP >> Increment / Decrement Operators in PHP

Increment / Decrement Operators in PHP

1- Operator-           ++X
   Name-               Pre-Increment
   Description-        Increment X by one,Then return X
   Example             $x = 5;  echo ++$x; 6

2- Operator-           X++
   Name-               Post-Increment
   Description-        Return X, then increment X by one
   Example             $x = 5;  echo $x++; 5

3- Operator-           --X
   Name-               Pre-Decrement
   Description-        Decrement X by one,Then return X
   Example             $x = 5;  echo --$x; 4

4- Operator-           X--
   Name-               Post-Decrement
   Description-        Return X, then decrement X by on
   Example             $x = 5;  echo $x--; 5

 

Post Your Comment

Next Questions
Comparision Operators
Logical operators
Array Operators
String
addcslashes() function
addslashes() function
chunk_split() function
crc32() function
explode() function
implode() function
join() function
ltrim() function
md5() function
metaphone() function
money_format() function
nl2br() function
number_format() function
ord() function
parse_str() function
printf() function
quotemeta() function
rtrim() function
sha1() function
sha1_file() function
similar_text() function

Copyright ©2022 coderraj.com. All Rights Reserved.