tags:

views:

60

answers:

2

Is it possible to put this code

$left_Nickels = 20;

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.

+4  A: 

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--;
}
Raz
Thank you, I am new to php, I wasn't really sure if this was possible, but this just re-affirmed what I was thinking about, thank you.
Newb
no problem, always a pleasure to help
Raz
+2  A: 

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 !

JeffPHP