If you know how the increment and decrement operators work, you’ll get the answer.
echo "Increment = " . $var1++ ;
//Prints $var1 and then increments the value
echo "Decrement = " . $var1-- ;
// Prints the incremented value from previous operation and then decrements the value
To achieve what you are trying to do, use --$var1
solved Can Someone help me resolving this increment/decrement issue [duplicate]