Locked lesson.
About this lesson
Understanding Variables in PHP.
Exercise files
Download this lesson’s related exercise files.
Variables.docx58.8 KB Variables - Solution.docx
59 KB
Quick reference
Variables
A variable is what you use to store something.
When to use
Anytime you have some data to store, use a variable.
Instructions
Variables in PHP start with a dollar sign: $
Variable names should be descriptive. If your variable will hold an age, name the variable $age or something like that.
Variable names can't start with a number.
Variable names contain alpha-numeric characters, and underscores.
Variable names are case sensitive.
Hints & tips
- Variables are like buckets that let you store stuff.
Lesson notes are only available for subscribers.