All variables in PHP start with a $ symbol followed by the variable name:
$name = "Alice";
$age = 25;
$price = 9.99;$UserName ≠ $usernamePHP has three main scopes:
You can use one variable to name another (dynamic variable):
$name = "PHP";
$$name = "Rocks";
echo $PHP; // Outputs: RocksUse cautiously — this can make code harder to read.
You can freely reassign variables to different types:
$x = 5;
$x = "now a string";This is allowed because PHP is dynamically typed.
Ask the AI if you need help understanding or want to dive deeper in any topic