mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
implemented user note: example variables such as $bool and $int may be confusing
to some users coming from C/Java, using $a_bool, $an_int, etc. instead. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@208974 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
946cedcbbe
commit
c37c710bdf
1 changed files with 11 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.160 $ -->
|
||||
<!-- $Revision: 1.161 $ -->
|
||||
<chapter id="language.types">
|
||||
<title>Types</title>
|
||||
|
||||
|
@ -128,22 +128,23 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$bool = TRUE; // a boolean
|
||||
$str = "foo"; // a string
|
||||
$int = 12; // an integer
|
||||
$a_bool = TRUE; // a boolean
|
||||
$a_str = "foo"; // a string
|
||||
$a_str2 = 'foo'; // a string
|
||||
$an_int = 12; // an integer
|
||||
|
||||
echo gettype($bool); // prints out "boolean"
|
||||
echo gettype($str); // prints out "string"
|
||||
echo gettype($a_bool); // prints out: boolean
|
||||
echo gettype($a_str); // prints out: string
|
||||
|
||||
// If this is an integer, increment it by four
|
||||
if (is_int($int)) {
|
||||
$int += 4;
|
||||
if (is_int($an_int)) {
|
||||
$an_int += 4;
|
||||
}
|
||||
|
||||
// If $bool is a string, print it out
|
||||
// (does not print out anything)
|
||||
if (is_string($bool)) {
|
||||
echo "String: $bool";
|
||||
if (is_string($a_bool)) {
|
||||
echo "String: $a_bool";
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
|
|
Loading…
Reference in a new issue