PHP Variables
1 min read
PHP Variables
A variable starts with the $ sign, followed by the name of the variable.
<?php
$name = "Alex";
$age = 25;
$price = 9.99;
echo "Name: $name, Age: $age";
Rules for variable names
- Must start with a letter or underscore
_ - Cannot start with a number
- Can only contain letters, numbers and underscores
- Names are case-sensitive (
$ageand$AGEare different)