What are variables in PHP and how to define them?
Variables are "containers" for storing information.
Purposes of variable in PHP:
- A variable name must start with a leading dollar sign ($),which is followed by name.
- A variable name cannot start with a number.
- Variable names are case-sensitive ($age and $AGE are two different variables)
- Variables used before they are assigned have default values.
- PHP does a good job of automatically converting types from one to another when necessary.
$txt = "Hello,how’s life goin on?";
echo "Gud $txt";
Gud, Hello,how’s life goin on?