Php Variable Assignment

"; docommand("Add 2"); docommand("Increment value by 6"); docommand("Decrement value by 8"); docommand("Multilpy value by 10"); docommand("Divide by 5"); docommand("Multiply this $thevalue with $thevalue"); ?

Value is now ".$variable.""; $variable -= 4; echo "Subtract 4.

Value is now ".$variable.""; $variable *= 5; echo "Multiply by 5.

if you write echo "mytext".$result-- the correct return result would be given by echo "mytext".(--$result) another problem that you noticed was that the Dot (.) operator is not always processed last so braces () become mandatory.

:) you are actually using the direct return value from the decrement function.

$result-- ; echo ''; and the output is like this: Value now is 8 Add 2, Value now is 10 Subtract 4, Value now is 6 Multiply by 5, Value now is 30 Divide by 3, Value now is 10 Increment by one, Value now is 10 Decrement by one, Value now is 11 Why the value in the last value (increment and decrement by one) is miscalculated? I appreciate all of your effort for helping me, thanks before.. --$v .'.'; this was the result when Value is now 8Add 2.

$result ;echo ''; echo 'Decrement by one, Value now is '.

Literal strings do not attempt to parse special characters or variables.

If using single quotes, you could enter a variable name into a string like so: When using interpolation, it is often the case that the variable will be touching another character.

After the division of the value in $result by three, quotient is stored in $result.

so i guess what you wanted to accomplish was echo 'Value now is '.($result = 8).''; echo 'Add 2, Value now is '.($result =2).''; echo 'Subtract 4, Value now is '.($result -= 4).''; echo 'Multiply by 5, Value now is '.($result *= 5).''; echo 'Divide by 3, Value now is '.($result /= 3).''; echo 'Increment by one, Value now is '.( $result).''; echo 'Decrement by one, Value now is '.(--$result).''; In $result , the result is first stored and then incremented and that same for $result--.


Comments Php Variable Assignment

The Latest from ©