PHP Variables, Variables are one of the most important aspects of every programming language. They allow you to store a value within a named container, for later use or manipulation. Storing and retrieving something from memory is a complicated task, but fortunately, PHP hides all this low level stuff, and makes it super easy to declare and use variables.
In PHP, a variable is declared using $ sign followed by variable name.Syntax for declaring a variable in PHP is given below :
Some of Examples of PHP Variables :
$txt = "Study Clues";
$x = "PHP";
$y = 5;
After the execution of the statements above, the variable $txt will hold the value Study Clues, the variable $x will hold the value PHP, and the variable $y will hold the value 5.
Note :PHP variable names are case-sensitive.
Note :When you assign a text value to a variable, put quotes around the value.
Note :A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).