![]() | ||
Add caption |
Variable
String:
<?
$var1="sam";
print "my name is $var1";
?>
Boolean:
$var1=true=1;
$var2=false=0='';
Special Variable:
some variable you can not use it as it has its own value:
$GLOBLAS
$_POST
$_GET
$_REQUEST
$_SERVER
$_COOKIE
$_FILES
$_ENV
$_SESSION
Variable Variable
Example:<?Note: two dollars sign: the input will print and ask you to input value for variable by using $_GET, and after get input to $_GET, it will be displayed to the print line.In this case, you have only two choice to replaced variable is var1 and var2. Otherwise, result will not get any variable to display.
$var1=""john";
$var2="SAM";
print ("you choose $$_GET["variable"] to be your advisor");
?>