In Variable in nothing it is just a name of the memory location. A variable is simply a container i.e used to store both numeric and non-numeric information.
Rules For Declaring variables
Variables in PHP starts with a doller ($) sign, followed by the name of the variable.
The Variable name must being with a letter of the underscore character.
A variable name can only contain alpha-numeric characters and underscroe.
A variable name should not contain spaces.
Pass multiple strings
/* creating Variable in php */
<?php
$mycar = "Honda City";
echo $mycar."Is Running";
?>
In the above exampe $mycar is a variable which hold the value of Honda City car.
Deleting the PHP variable :- To destroy a variable after using, pass the variable to PHP's unset() function.
/* destroying Variable in php */
<?php
$mycar = "Honda City";
echo $mycar."Is Running";
unset($mycar);
echo $mycar."Is Running";
?>
PHP $ and $$ Variable
$$var uses the value of the variable whose name is the value of $var. It means $$var is known as refrence variable where as $var is normal variable.
It allows you to have a "variable's variable" - hte program can create the variable name the same way it can create any string.
PHP Super Global Variables
PHP super global variable is used to connect PHP with HTML Form. PHP Super global variable is accessible inside the same page that defines it, as well as outside the page. While local variable's scope is within the page that defines is. PHP Super Global Variables Are Given Bellow
$_GET['var_name']
$_POST['var_name']
$_REQUEST['var_name']
$_FILES['var_name']
$_SESSION['var_name']
$_COOKIE['var_name']
$_SERVER['var_name']
PHP Constant
Constant are PHP container that remain constant and never change.
Constant are used for data that is unchanged at multiple place within our program.
Variables are temporary storage while Constant are permanent.
Use Constant for values that remain fixed and refrenced multiple times.