Before a variable is used, you must declare it. To declare a variable in PHP, you can use the following syntax:
To assign a value to the variable, write:
Note: The name of variable must start with a letter or underscore not a number.
To use the value of the variable, you need only specify $ and variable name.
$var="I like PHP very much.";
echo $var; // the value of var is used(display on the screen)
Note: It is no need to specify data type when you declare a variable in PHP.
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: