1 No pre-defined use required
2 in PHP the type is declared variable must be used with a dollar sign $ followed by a variable to represent such as $a=100; $b = "string"
The unset () function releases the specified variable
The Isset () function detects if a variable is set
The empty () function detects if a variable is empty
Example:
<?php
$var = ""; Declare variable $var to give a null value
if (empty ($var))
{echo ' $var is either 0 or not set at all ';}
if (Isset ($var))
{echo ' $var is not set at all ';} The result is true. Because $var has been set
Unset ($var);
if (Isset ($var))
{print "This var was set so I'll print.";}
?>
Variable naming
1 variable names are strictly case-sensitive, but built-in structures and keywords and user-defined class names and function names are case-insensitive.
For example, echo while class, and so on can be any case
Assigning a reference to a variable
<?php
$a = ' Bob ';
$b =& $a
?>
A and B as long as any one of these changes, the other will change.
Type Introduction
The type of the variable is usually not set by the programmer, rather, it is determined by the context at which PHP is used according to the variable.
If you want to see the value and type of an expression, you can use the function var-dump ()
For example
<?php
$bo =ture;
$AA = "Foo";
$in = 12;
Var-dump ($BO); Direct output variable $bo type and value bool (TRUE)
Var-dump ($AA); Direct output string (3) "Foo"
Var-dump ($in); Direct output int (12)
?>
PHP variable definition and use