PHP Types
PHP Code Examples
[Download]   [Execute]
<!-- The include directive just copies in the included file.  This one
     generates boiler plate needed at the start of file.  It uses the
     value of $title that we set here.  The included file starts in
     HTML mode, and its mode at finish does not pass to the including 
     file. -->
// Generate the page header.
$title = "PHP Types";
include '../';

// Play with booleans.
echo "<b>Booleans</b>.  What an amazing concept.<br>\n";
$yes = TRUE;
$no = FALSE;
$maybe = 5 > 4;
echo "[$yes] [$no] [$maybe]<p>\n";

// Integers
$int = 45;
$oct = 045;
$hex = 0x45;
$div = 5/6;
echo "<b>Integer:</b> $int $oct $hex $div<p>\n";

// Floats
$x = 4.5;
$y = 2.1e17;
echo "<b>Float:</b> $x $y<p>\n";

// Lots of things to do with strings.
echo "<b>Strings:</b><br>";
$fred = "Tim";
$freds = "Willoby";
$barney = "fred";
echo "$fred $freds {$fred}s ${fred}s<br>";
echo "${barney} ${$barney}<br>";
$mike = $fred . '-' . $barney;
echo "$mike $fred[2]<br>";
$ss = <<<ALDONE
So $fred never saw<br>
$freds or the train.
echo $ss;
echo '<br>$fred and $barney went to the movies.';