Something we need to fully understand when learning any programming
language, is how to use variables. This might sound simple but even when
it is, every program needs variables to store data we use.
How do variables work? and how do I declare one?
To declare them it’s simple, you only have to create them by giving them a proper name that follows these rules.
- always start the variable with the ‘$’ sign
- exactly after the dollar sign, type any letter or underscore ‘_’
- limit your variable’s name to alphanumeric characters(beside the first $ character)
Here’s an example, well, examples…
04 | $_first = "this is my first variable" ; |
05 | $another2 = "my second variable" ; |
08 | $3var = "a third variable?" ; |
Now if you want, you may practice more visually by watching this video tutorial on variable declarations.
Variable’s video tutorial
Well everybody, that’s all for today’s lesson, thank you for passing by and please don’t forget to comment!!