Variable Manipulation

Variables can also be manipulated as in the following example. This works similarly to the prior example and is just a more verbose way of expressing the same statements:

Code:
1 //integers
2 $foo 0;         //creates the variable $foo
3 $foo $foo  2//increases the value of $foo by 2
4 $foo $foo  3//multiplies the value of $foo by 3
5 $foo $foo 2;  //decreases the value of $foo by 2
6 $foo $foo 2;  //divides the value of $foo by 2
7
8 //strings
9 $bar "this is a string";         //creates the variable $bar
10 $bar $bar " additional data";  //append the string with "additional data"


Page: 1 2 3 4 5 6
Tutorial posted by: Patrick Kelly, Friday March 3, 2011