<!DOCTYPE html>
<html>
<!-- playing with PHP...
by: Sharon Tuttle
last modified: 4-22-13
-->
<head>
<title> Playing with variables </title>
<meta charset="utf-8" />
</head>
<body>
<?php
$welcome_msg = 'Hello and welcome';
$var1 = 2;
$var2 = 4.35;
?>
<h1> <?= $welcome_msg ?> </h1>
<?php
echo "<p> $var1 </p>\n";
// use . for concatenation
print '<p> $var2 is '."$var2 </p>\n";
echo "<p>";
echo $var1;
echo "</p>\n";
?>
<?php
$name = "Snoopy";
$dog = "Caesar";
?>
<p> <?= "$name".'$dog' ?> </p>
<?php
$thing1 = 3;
$thing2 = "3";
if ($thing1 == $thing2)
{
echo "<p> these are == equal </p>\n";
}
else
{
echo "<p> these are NOT == equal </p>\n";
}
if ($thing1 === $thing2)
{
echo "<p> these are === equal </p>\n";
}
else
{
echo "<p> these are NOT === equal </p>\n";
}
sayHello();
function sayHello()
{
print "<h1> Hello! </h1>\n";
}
?>
<?php
require_once("my-std-footer.html");
?>