Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autodecrementing variables

Status
Not open for further replies.

theoneweasel77

Programmer
Aug 10, 2004
54
0
0
US
I know that if you have a variable $var = "c", you can say $var++ and $var now equals d. Can you autodecrement $var? (I used $var-- and it didn't change the value).
 
so, if I made it a string, could I get away with it? (example $var = "foo" $var-- would give me "fon")
 
that didn't work either... What is meant by "character variables"?
 
In case anyone wondered, there is a way around this with the chr function
 
You could probably do something using chr(). But first, you have do define what the decrement means, particularly at the limits of its range.

If $var = 'a', what will the value in $var be after $var-- ?


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top