Assign values to variable and use them later in the html in PHP
Description
The following code shows how to assign values to variable and use them later in the html.
Example
<?php//w w w . ja v a2 s .co m
$YourName = "Leon";
$Today = date("l F d, Y");
$CostOfLunch = 3.50;
$DaysBuyingLunch = 4;
?>
<html>
<body>
Today's Date:
<?php
/*
** print today's date
*/
print("<h3>$Today</h3>\n");
/*
** print message about lunch cost
*/
print("$YourName, you will be out ");
print($CostOfLunch * $DaysBuyingLunch);
print(" dollars this week.<br>\n");
?>
</body>
</html>
The code above generates the following result.