<html>
<head><title>Type Casting</title></head>
<body bgcolor="aqua">
<font face="verdana" size="+1">
<?php
$string = "500";
$number = (int) $string;
echo "The value in \$string has been cast to an int: "
, $number, "<br />";
?>
<hr>
<?php
$total_seconds = 1132; //Total running time in seconds
echo($total_seconds / 60);
$minutes = (int)($total_seconds / 60); /* Result of expression
is cast to an integer */
$seconds_left = $total_seconds % 60; // Modulus returns
// seconds left
print "You ran for $minutes minutes and $seconds_left
seconds\n.";
?>
<hr>
<?php
$total = 5;
$non_float_total = (int) 5;
echo $non_float_total + 2.3;
$total = (float) $total;
echo "\$total has been cast to float: ", $total + 2.3, "<br />";
if( "2"> "100 dogs") {print "true";}
?>
</body>
</html>