🐘 PHP Variables
In PHP, variables store data like text, numbers, or other information. All variables start with a $
symbol.
📝 Example: Creating and Using Variables
Output will appear here...
📖 Key Variable Rules
- Variables start with a
$
, like $myVar
.
- Names can contain letters, numbers, and underscores — but can't start with a number.
- Use
=
to assign a value to a variable.
- Strings are wrapped in quotes
" "
or ' '
, and numbers are written without quotes.
- Concatenate (join) strings using a
.
(period) operator.
💡 Tip: PHP is loosely typed, so you don't have to declare the type of a variable before using it.