<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> more PHP play </title> <meta charset="utf-8" /> <?php /*---- signature: square: number -> number purpose: expects a number, and returns the square of that number ----*/ function square($num) { return $num * $num; } ?> <link href="http://users.humboldt.edu/smtuttle/styles/normalize.css" type="text/css" rel="stylesheet" /> </head> <body> <h1> More PHP play </h1> <p> (did NOT say it was pretty...!) </p> <?php $name = "Snoopy"; $dog = "Caesar"; ?> <p> The square of 42 is <?= square(42) ?> </p> <p> <?= "$name".'$dog' ?> </p> <p> About to set $thing1 to "dog", and $thing2 to 'dog'. </p> <ul> <?php $thing1 = "dog"; $thing2 = 'dog'; if ($thing1 === $thing2) { ?> <li> $thing1 and $thing2 are both dog (AND the same type)! </li> <?php } else { ?> <li> $thing1 and $thing2 are NOT both (dog AND the same type)! </li> <?php } ?> </ul> <p> About to set $val1 to FALSE, and $val2 to 0 </p> <ul> <?php $val1 = FALSE; $val2 = 0; if ($val1 == $val2) { ?> <li> $val1 and $val2 have the same value! (not necessarily the same type) </li> <?php } else { ?> <li> $val1 and $val2 do NOT have the same value! </li> <?php } ?> <?php if ($val1 === $val2) { ?> <li> $val1 and $val2 have the same value AND the same type! </li> <?php } else { ?> <li> $val1 and $val2 do not have (same value *and* type)! </li> <?php } ?> </ul> <p> About to set $v1 to "13", and $v2 to 13 </p> <ul> <?php $v1 = "13"; $v2 = 13; if ($v1 == $v2) { ?> <li> $v1 and $v2 have same value (but not necessarily the same type)! </li> <?php } else { ?> <li> $v1 and $v2 do not have same value! </li> <?php } ?> <?php if ($v1 === $v2) { ?> <li> $v1 and $v2 have same value AND type! </li> <?php } else { ?> <li> $v1 and $v2 do not have (same value AND type)! </li> <?php } ?> </ul> <?php require_once("328footer.txt"); ?>