PHP variables are case-sensitive i.e. $name and $Name are treated as two different variables. PHP variable names must start with either a letter or an _ (underscore). PHP variables cannot start with a numeric value(e.g. $1apple). PHP variables cannot contain special characters other then $ or _ PHP variables can hold strings,booleans,integers,float,objects etc. e.g. : $abc; //Allowed $_abc; //Allowed $abc11; //Allowed $#abc; //Not allowed (only _ and $ special characters are allowed) $11abc; //Not allowed (variable cannot start with numeric digit) |
<html> <head> <body> <h1> <?php $message = "Hello there!"; echo $message; echo "<br/>"; $name = "Hello there!"; echo $name; echo "<br/>"; $message = "Mike"; echo $message; echo "<br/>"; $age = "19"; echo $age; ?> </h1> </body> </html>
Output
Hello there! Mike 19