In PHP, we specify variables with a dollar ($) sign. Even here you can deduce that PHP is a very rich language.
A list of rules that you must follow when defining a variable;
-
You cannot use characters other than letters, numbers, and underscores (_).
-
You cannot initialize the variable name with a number. (
$1
variable is false,$variable1
is true) -
PHP distinguishes variable names, so
$variable
is not the same as$VaRiAbLe
.
All terms matching these three rules can be a variable names.
Here are a few examples of suitable variables: $fruits
, $mail_box
, $easy1
, $x
, $_php