note 89929 deleted from language.types.intro by danbrown
| From: | danbrown@php.net | Date: | Mon, 01 Jun 2009 13:10:10 +0000 |
| Subject: | note 89929 deleted from language.types.intro by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156260@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
This example provides a great opportunity to emphasize the newline issue as it relates to HTML
rendering.
<?php
$a_bool = TRUE; // a boolean
$a_str = "foo"; // a string
$a_str2 = 'foo'; // a string
$an_int = 12; // an integer
echo 'a_bool is a ';
echo gettype($a_bool);
echo '<br>';
echo 'a_str is a ';
echo gettype($a_str); // prints out: string
echo '<br>';
echo 'an_int is a ';
echo gettype($an_int); // prints out: string
echo '<br>';
// If this is an integer, increment it by four
if (is_int($an_int)) {
$an_int += 4;
echo "<br>integer: $an_int";
}
// If $bool is a string, print it out
// (does not print out anything)
if (is_string($a_bool)) {
echo "String: $a_bool";
}
?>