开发者

Decrementing the value of a variable

Is it possible to put this code

$left_Nickels = 20开发者_StackOverflow社区;

Inside any conditional and decrement the value of $left_Nickles?

Or do I have to initialize to "".

I want to be able to decrement the quantity of 20, which indicates the number of Nickels?

That's why I don't want to start of by initializing to "", and then later on in a conditional assigning $left_Nickels = 20;

Thank you, for not flaming the newb, but for helping the newb to understand and learn.


http://php.net/manual/en/language.operators.increment.php

if i understood your question you want something like

$left_Nickels = 20;
.................
if (something){
$left_Nickels--;
}


Be aware that $left_Nickels-- will decrement after executing the line, where --$left_Nickels will decrement before executing the line. In this very examples the result is the same, but when used in other context, it might help knowing this !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜