PHP programming - chapter 3

valid constant and variable that important:
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:
<?
$var1=""john";
$var2="SAM";
print ("you choose $$_GET["variable"] to be your advisor");
?>

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.

0 comments em “PHP programming - chapter 3”

Post a Comment

 

Personal I.T blogs Copyright © 2011 -- Template created by O Pregador -- Powered by Blogger