How to create variables in PHP?
In PHP, variables are created using the $ (dollar sign) followed by the variable name. You do not need to declare the type explicitly (PHP is dynamically typed).
Variable Naming Rules:
- Must start with
$(e.g.,$myVar). - Can contain letters (
A-Z, a-z), numbers (0-9), and underscores (_). - Cannot start with a number (e.g.,
$1name). - Case-sensitive (
$varand$VARare different).
Example:
$name = "Sandeep";
echo "Hello, $name";
Output:

