Decrement Number in PHP. In this program we can print the number using the post decrement operator. A post-decrease operator is used to decrement the value of a variable after executing the expression in which the operator is utilised. The variable’s value is used in an expression before being decremented using the post-decrement operator.
$x = 10;
Purpose of Post Decrement Operator in PHP
After an expression has been fully executed, the post-increment operator is used to increase the value of a variable. In the Post-Increment, value is first used in an expression and then incremented. If the operand is a pointer, the operation subtracts 1 from the value of the scalar operand, or increases the operand by the size of the object to which it points.
Post Increment and Post Decrement in PHP
The distinction is: ++ I will update the value of the I variable and return it, whereas $i++ will return the original value, hence increment it. The term “post-increment” refers to the use of $i++. After allocating the original value of I to $j, it increments the value of $i. ++ Pre-increment is referred to as $i.