PHP TutorialLesson 6Free preview
PHP Variables
This lesson is part of PHP · All levels
Summary
A variable is a named container for storing data in PHP, always written with a dollar sign on the front. This lesson discusses naming rules, the nature of dynamic data types, and the difference between variables and constants. Since PHP doesn't require type declarations, you just give them a value and PHP determines the type itself.
Key points
- The variable is always preceded by the symbol $, for example $name
- The name of the variable may contain letters, numbers, and lower case, but it must not precede a number
- PHP has a dynamic data type so the type follows the stored values
- The variable only keeps one value at a time
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.