mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
More fixes.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@51474 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
3db5361150
commit
688cbce5dc
1 changed files with 38 additions and 38 deletions
|
@ -89,7 +89,7 @@
|
|||
(at least it is for the operator-defs)
|
||||
|
||||
<simpara>
|
||||
In parameter definitions you can also encouter the 'number' pseudo-type,
|
||||
In parameter definitions you can also encounter the 'number' pseudo-type,
|
||||
that indicates a parameter that is either <type>integer</type> or
|
||||
<type>double</type>.
|
||||
</simpara>
|
||||
|
@ -177,14 +177,14 @@ if ($show_separators)
|
|||
<sect2 id="language.types.boolean.casting">
|
||||
<title>Converting to boolean</title>
|
||||
<simpara>
|
||||
To explicitely convert a value to <type>boolean</type>, use either
|
||||
To explicitly convert a value to <type>boolean</type>, use either
|
||||
the <literal>(bool)</literal> or the <literal>(boolean)</literal> cast.
|
||||
However, in most cases you do not need to use the cast, since a value
|
||||
will be automatically converted if an operator, function or
|
||||
control structure requires a <type>boolean</type> argument.
|
||||
</simpara>
|
||||
<simpara>
|
||||
See also <link linkend="language.types.type-juggling">type-juggling</link>.
|
||||
See also <link linkend="language.types.type-juggling">Type Juggling</link>.
|
||||
</simpara>
|
||||
|
||||
<para>
|
||||
|
@ -295,7 +295,7 @@ $a = 0x1A; # hexadecimal number (equivalent to 26 decimal)
|
|||
</para>
|
||||
<note><!-- or warning? -->
|
||||
<simpara>
|
||||
In PHP there is no such thing as integer-division. <literal>1/2</literal>
|
||||
In PHP there is no such thing as integer division. <literal>1/2</literal>
|
||||
yields the <type>double</type> <literal>0.5</literal>. <!-- See
|
||||
??? for more information. (with the operators, or with type-jug) -->
|
||||
</simpara>
|
||||
|
@ -336,12 +336,13 @@ var_dump($large_number);
|
|||
</informalexample>
|
||||
<warning>
|
||||
<simpara>
|
||||
Unfortunately, there is a bug in the script engine (still present in
|
||||
4.0.6, probably resolved in 4.0.7) so that this does not always work
|
||||
correctly when there are negative numbers involved. However when both
|
||||
operands are positive, there is no problem. For example: when you do
|
||||
<literal>-50000 * $million</literal>, the result will be
|
||||
<literal>-429496728</literal>.
|
||||
Unfortunately, there is a bug in the script engine (still
|
||||
present in 4.0.6, probably resolved in 4.0.7) so that this
|
||||
does not always work correctly when there are negative numbers
|
||||
involved. For example: when you do <literal>-50000 *
|
||||
$million</literal>, the result will be
|
||||
<literal>-429496728</literal>. However, when both operands are
|
||||
positive there is no problem.
|
||||
</simpara>
|
||||
</warning>
|
||||
</para>
|
||||
|
@ -351,7 +352,7 @@ var_dump($large_number);
|
|||
<sect2 id="language.types.integer.casting">
|
||||
<title>Converting to integer</title>
|
||||
<simpara>
|
||||
To explicitely convert a value to <type>integer</type>, use either
|
||||
To explicitly convert a value to <type>integer</type>, use either
|
||||
the <literal>(int)</literal> or the <literal>(integer)</literal> cast.
|
||||
However, in most cases you do not need to use the cast, since a value
|
||||
will be autmatically converted if an operator, function or
|
||||
|
@ -372,7 +373,7 @@ var_dump($large_number);
|
|||
</sect3>
|
||||
|
||||
<sect3 id="language.types.integer.casting.from-double">
|
||||
<title>From floating point numbers</title>
|
||||
<title>From <link linkend="language.types.double">floating point numbers</link></title>
|
||||
<simpara>
|
||||
When converting from float to integer, the number will
|
||||
be rounded <emphasis>towards zero</emphasis>.
|
||||
|
@ -393,7 +394,7 @@ var_dump($large_number);
|
|||
sometimes lead to unexpected results.
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
echo (int) ( (0.1+0.7) * 10 ); // echo's 7!
|
||||
echo (int) ( (0.1+0.7) * 10 ); // echoes 7!
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
||||
|
@ -414,14 +415,14 @@ echo (int) ( (0.1+0.7) * 10 ); // echo's 7!
|
|||
<sect3 id="language.types.integer.casting.from-other">
|
||||
<title>From other types</title>
|
||||
<para>
|
||||
Behaviour of converting to integer is undefined for other
|
||||
types. Currently, the behaviour is the same as if
|
||||
the value was first <link linkend="language.types.boolean.casting"
|
||||
>converted to boolean</link>.
|
||||
<caution>
|
||||
<simpara>
|
||||
However, do <emphasis>not</emphasis>
|
||||
relay on this behaviour, as it can change without notice.
|
||||
Behaviour of converting to integer is undefined for other
|
||||
types. Currently, the behaviour is the same as if the value
|
||||
was first <link linkend="language.types.boolean.casting"
|
||||
>converted to boolean</link>. However, do
|
||||
<emphasis>not</emphasis> relay on this behaviour, as it can
|
||||
change without notice.
|
||||
</simpara>
|
||||
</caution>
|
||||
</para>
|
||||
|
@ -441,7 +442,7 @@ echo (int) ( (0.1+0.7) * 10 ); // echo's 7!
|
|||
<sect1 id="language.types.double">
|
||||
<title>Floating point numbers</title>
|
||||
<para>
|
||||
Floating point numbers (aka "doubles", "floats" or "real numbers") can be
|
||||
Floating point numbers (AKA "doubles", "floats" or "real numbers") can be
|
||||
specified using any of the following syntaxes:
|
||||
<synopsis>
|
||||
$a = 1.234; $a = 1.2e3; $a = 7E-10;
|
||||
|
@ -664,21 +665,21 @@ echo 'I am trying to include at this point: \n a newline';
|
|||
<simpara>
|
||||
It is very important to note that the line with the closing
|
||||
identifier contains no other characters, except
|
||||
<emphasis>possibly</emphasis> a <literal>;</literal>.
|
||||
<emphasis>possibly</emphasis> a semicolon (<literal>;</literal>).
|
||||
That means especially that the identifier
|
||||
<emphasis>may not be indented</emphasis>, and there
|
||||
may not be any spaces or tabs after or before the <literal>;</literal>.
|
||||
may not be any spaces or tabs after or before the semicolon.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Probably the nastiest gotcha is that there may also
|
||||
not be a carriage return (<literal>\r</literal>) at the end of
|
||||
the line, only
|
||||
a form feed, a.k.a. newline (<literal>\n</literal>).
|
||||
a form feed, AKA newline (<literal>\n</literal>).
|
||||
Since Microsoft Windows uses the sequence
|
||||
<literal>\r\n</literal> as a line
|
||||
terminator, your heredoc may not work if you write your
|
||||
script in a windows editor. However, most programming
|
||||
editors provide a way to save your files with UNIX
|
||||
script in a Windows editor. However, most programming
|
||||
editors provide a way to save your files with a UNIX
|
||||
line terminator.
|
||||
<!--
|
||||
FTP will sometimes automatically convert \r\n to \n while
|
||||
|
@ -750,7 +751,7 @@ EOT;
|
|||
<link linkend="language.types.string.parsing.complex">complex</link>
|
||||
one.
|
||||
The simple syntax is the most common and convenient, it provides a way
|
||||
to parse a variable, an array-value, or a object-property.
|
||||
to parse a variable, an array value, or an object property.
|
||||
</simpara>
|
||||
<simpara>
|
||||
The complex syntax was introduced in PHP 4,
|
||||
|
@ -761,11 +762,10 @@ EOT;
|
|||
<sect4 id="language.types.string.parsing.simple">
|
||||
<title>Simple syntax</title>
|
||||
<simpara>
|
||||
If a <literal>$</literal> is encoutered, the parser will
|
||||
greedily take as much tokens as possible to form a valid
|
||||
variable name. Enclose the the variable name in curly
|
||||
braces if you want to explicitely specify the end of the
|
||||
name.
|
||||
If a dollar sign (<literal>$</literal>) is encountered, the
|
||||
parser will greedily take as much tokens as possible to form a
|
||||
valid variable name. Enclose the variable name in curly
|
||||
braces if you want to explicitly specify the end of the name.
|
||||
</simpara>
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
|
@ -776,12 +776,12 @@ echo "He drunk some ${beer}s"; // works
|
|||
</programlisting>
|
||||
</informalexample>
|
||||
<simpara>
|
||||
Similary, you can also have an array-index and an
|
||||
object-property parsed. With array-indices, the
|
||||
']' marks the end of the index, for object-properties
|
||||
the same rules apply as to simple variables, though
|
||||
with object properties there doesn't exist a trick
|
||||
like the one with variables.
|
||||
Similary, you can also have an array index or an object
|
||||
property parsed. With array indices, the closing square bracket
|
||||
(<literal>]</literal>) marks the end of the index. For
|
||||
object properties the same rules apply as to simple variables,
|
||||
though with object properties there doesn't exist a trick like
|
||||
the one with variables.
|
||||
|
||||
<!-- XXX isn't &true; :(, this would be the trick
|
||||
Also,
|
||||
|
@ -1080,7 +1080,7 @@ array( <optional> <replaceable>key</replaceable> => </optional> <replaceable
|
|||
<sect3 id="language.types.array.syntax.modifying">
|
||||
<title>Creating/modifying with square-bracket syntax</title>
|
||||
<para>
|
||||
You can also modify an existing array, by explicitely setting
|
||||
You can also modify an existing array, by explicitly setting
|
||||
values.
|
||||
</para>
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue