In this PHP tutorial, we learn how to work with variables.  We walk through preforming some simple calculations and outputting the data to the web browser.

Video Tutorial

Example Project Code

 <h1>Working with Variables</h1>

 $myname = "Nathan";
 $num1 = 6;
 $num2 = 4.5;

echo "My Name is " . $myname . "!<br>";
 echo "num1 is = to " . $num1 . "<br>";
 echo "num2 is = to " . $num2 . "<br>";

$total = $num1 * $num2;

echo "num1 times num2 is " . $total;



Pin It on Pinterest

Share This

Share this post with your friends!

%d bloggers like this: