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

<html>
 <body>
 <h1>Working with Variables</h1>

<?php
 $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;

?>

</body>
</html>

Pin It on Pinterest

Share This

Share this post with your friends!

%d bloggers like this: