|
|
| Line 1: |
Line 1: |
| − | <?php <br />
| + | |
| − | $a_bool = TRUE; // a boolean <br />
| |
| − | $a_str = "foo"; // a string <br />
| |
| − | $a_str2 = 'foo'; // a string <br />
| |
| − | $an_int = 12; // an integer <br />
| |
| − | <br />
| |
| − | echo gettype($a_bool); // prints out: boolean <br />
| |
| − | echo gettype($a_str); // prints out: string <br />
| |
| − | <br />
| |
| − | // If this is an integer, increment it by four <br />
| |
| − | if (is_int($an_int)) { <br />
| |
| − | $an_int += 4; <br />
| |
| − | } <br />
| |
| − | <br />
| |
| − | // If $bool is a string, print it out <br />
| |
| − | // (does not print out anything) <br />
| |
| − | if (is_string($a_bool)) { <br />
| |
| − | echo "String: $a_bool"; <br />
| |
| − | } <br />
| |
| − | ?> <br />
| |