PHP Variables are like containers that are used to store data or information.
In PHP All variable names must start with a
$ sign, followed by the name of the variable. Like this –
You can declare variables anywhere in the PHP script.
= equal sign is used to assign value for a variable.
= equal sign is called Assignment Operator.
<?php $name = "John Doe"; // Declaring a variable echo $name; // Displaying the variable value ?>
To Declare or Create a PHP Variable you have to follow some Rules –
📝 In PHP, variable names are case-sensitive. In the following example, both are different variables –
<?php $searchengine = "Google"; $searchEngine = "Yahoo"; ?>