Some PHP Examples
Just like HTML, quotes are single or double:
<?PHP
echo "Mike's drums are over there.<br>";
echo 'Mike said, "hi!"<br>';
?>
You don't specify the variable type, the interpreter will automatically use a variant-type variable. To Declare, just assign:
<?PHP
$fullname = 'Mike Prestwood';
$FullName = 'Wes Peterson';
$Age = 38;
$Weight = 162.4;
//Variable within a literal.
echo "Your name is $fullname.<br>";
echo "You are $Age and weigh $Weight.<br>";
//$ within a literal ok too.
echo "That will be $1.52.<br>";
?>
PHP is case sensitive with variables too:
<?PHP
$fullname = 'Mike Prestwood'; //This is different...
$FullName = 'Wes Peterson'; //than this.
echo $fullname;
echo $FullName;
?>
By Reference uses "&" as in:
<?PHP
$MyOriginalVar = "Mike";
$MyNewVar = &$fullname;
echo $MyOriginalVar; //Mike
echo $MyNewVar; //Mike
$MyNewVar = "Lisa";
echo $MyOriginalVar; //Lisa (original changed!)
echo $MyNewVar; //Lisa
?>