mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Added <?php tags, always use para/note/(sim)para
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@131309 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
45f5fbc352
commit
0fc913567d
1 changed files with 102 additions and 86 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.77 $ -->
|
||||
<!-- $Revision: 1.78 $ -->
|
||||
<chapter id="control-structures">
|
||||
<title>Control Structures</title>
|
||||
|
||||
|
@ -326,7 +326,7 @@ endwhile;
|
|||
$i = 0;
|
||||
do {
|
||||
print $i;
|
||||
} while ($i>0);
|
||||
} while ($i > 0);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -360,7 +360,7 @@ do {
|
|||
}
|
||||
print "i is ok";
|
||||
|
||||
...process i...
|
||||
/* process i */
|
||||
|
||||
} while(0);
|
||||
?>
|
||||
|
@ -431,7 +431,7 @@ for ($i = 1; $i <= 10; $i++) {
|
|||
|
||||
/* example 2 */
|
||||
|
||||
for ($i = 1;;$i++) {
|
||||
for ($i = 1; ; $i++) {
|
||||
if ($i > 10) {
|
||||
break;
|
||||
}
|
||||
|
@ -543,12 +543,14 @@ foreach (array_expression as $key => $value) statement
|
|||
</para>
|
||||
</note>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
<literal>foreach</literal> does not support the ability to
|
||||
suppress error messages using '@'.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<note>
|
||||
<para>
|
||||
<literal>foreach</literal> does not support the ability to
|
||||
suppress error messages using '@'.
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
<para>
|
||||
You may have noticed that the following are functionally
|
||||
identical:
|
||||
|
@ -872,8 +874,8 @@ switch ($i) {
|
|||
</informalexample>
|
||||
</para>
|
||||
<para>
|
||||
A special case is the default case. This case matches anything
|
||||
that wasn't matched by the other cases, and should be the last
|
||||
A special case is the <literal>default</literal> case. This case matches
|
||||
anything that wasn't matched by the other cases, and should be the last
|
||||
<literal>case</literal> statement. For example:
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
|
@ -1089,15 +1091,17 @@ print_r (profile (TRUE));
|
|||
<simpara>For more information, see <link
|
||||
linkend="functions.returning-values">Returning values</link>.
|
||||
</simpara>
|
||||
<note>
|
||||
<simpara>
|
||||
Note that since <function>return</function> is a language
|
||||
construct and not a function, the parentheses surrounding its
|
||||
arguments are <emphasis>not</emphasis> required--in fact, it is
|
||||
more common to leave them out than to use them, although it
|
||||
doesn't matter one way or the other.
|
||||
</simpara>
|
||||
</note>
|
||||
<para>
|
||||
<note>
|
||||
<simpara>
|
||||
Note that since <function>return</function> is a language
|
||||
construct and not a function, the parentheses surrounding its
|
||||
arguments are <emphasis>not</emphasis> required--in fact, it is
|
||||
more common to leave them out than to use them, although it
|
||||
doesn't matter one way or the other.
|
||||
</simpara>
|
||||
</note>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
|
||||
|
@ -1146,18 +1150,21 @@ require ('somefile.txt');
|
|||
<simpara>
|
||||
See the <function>include</function> documentation for more examples.
|
||||
</simpara>
|
||||
<note>
|
||||
<simpara>
|
||||
Prior to PHP 4.0.2, the following applies: <function>require</function> will
|
||||
always attempt to read the target file, even if the line it's on never executes.
|
||||
The conditional statement won't affect <function>require</function>. However,
|
||||
if the line on which the <function>require</function> occurs is not executed,
|
||||
neither will any of the code in the target file be executed. Similarly, looping
|
||||
structures do not affect the behaviour of <function>require</function>. Although
|
||||
the code contained in the target file is still subject to the loop, the
|
||||
<function>require</function> itself happens only once.
|
||||
</simpara>
|
||||
</note>
|
||||
<para>
|
||||
<note>
|
||||
<simpara>
|
||||
Prior to PHP 4.0.2, the following applies: <function>require</function>
|
||||
will always attempt to read the target file, even if the line it's on
|
||||
never executes. The conditional statement won't affect
|
||||
<function>require</function>. However, if the line on which the
|
||||
<function>require</function> occurs is not executed, neither will any of
|
||||
the code in the target file be executed. Similarly, looping structures
|
||||
do not affect the behaviour of <function>require</function>. Although
|
||||
the code contained in the target file is still subject to the loop, the
|
||||
<function>require</function> itself happens only once.
|
||||
</simpara>
|
||||
</note>
|
||||
</para>
|
||||
|
||||
¬e.language-construct;
|
||||
|
||||
|
@ -1237,7 +1244,7 @@ echo "A $color $fruit"; // A green apple
|
|||
|
||||
function foo()
|
||||
{
|
||||
global $color;
|
||||
global $color;
|
||||
|
||||
include 'vars.php';
|
||||
|
||||
|
@ -1286,9 +1293,9 @@ echo "A $color $fruit"; // A green
|
|||
<![CDATA[
|
||||
<?php
|
||||
|
||||
/* This example assumes that www.example.com is configured to parse .php *
|
||||
* files and not .txt files. Also, 'Works' here means that the variables *
|
||||
* $foo and $bar are available within the included file. */
|
||||
/* This example assumes that www.example.com is configured to parse .php
|
||||
* files and not .txt files. Also, 'Works' here means that the variables
|
||||
* $foo and $bar are available within the included file. */
|
||||
|
||||
// Won't work; file.txt wasn't handled by www.example.com as PHP
|
||||
include 'http://www.example.com/file.txt?foo=1&bar=2';
|
||||
|
@ -1309,9 +1316,9 @@ include 'file.php'; // Works.
|
|||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
See also <link linkend="features.remote-files">Remote files</link>,
|
||||
<function>fopen</function> and <function>file</function> for related
|
||||
information.
|
||||
See also <link linkend="features.remote-files">Remote files</link>,
|
||||
<function>fopen</function> and <function>file</function> for related
|
||||
information.
|
||||
</para>
|
||||
<para>
|
||||
Because <function>include</function> and <function>require</function>
|
||||
|
@ -1351,13 +1358,15 @@ if ($condition) {
|
|||
values from included files. You can take the value of the include call as
|
||||
you would a normal function.
|
||||
</simpara>
|
||||
<note>
|
||||
<simpara>
|
||||
In PHP 3, the return may not appear inside a block unless it's
|
||||
a function block, in which case the <function>return</function> applies
|
||||
to that function and not the whole file.
|
||||
</simpara>
|
||||
</note>
|
||||
<para>
|
||||
<note>
|
||||
<simpara>
|
||||
In PHP 3, the return may not appear inside a block unless it's
|
||||
a function block, in which case the <function>return</function> applies
|
||||
to that function and not the whole file.
|
||||
</simpara>
|
||||
</note>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>include</function> and the <function>return</function> statement</title>
|
||||
|
@ -1413,8 +1422,7 @@ echo $bar; // prints 1
|
|||
<function>virtual</function>, and
|
||||
<link linkend="ini.include-path">include_path</link>.
|
||||
</simpara>
|
||||
|
||||
</sect1>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="function.require-once">
|
||||
<title><function>require_once</function></title>
|
||||
|
@ -1440,29 +1448,33 @@ echo $bar; // prints 1
|
|||
<ulink url="&url.php.pear;">PEAR</ulink> code included in the
|
||||
latest PHP source code distributions.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
<function>require_once</function> was added in PHP 4.0.1pl2
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
Be aware, that the behaviour of <function>require_once</function>
|
||||
and <function>include_once</function> may not be what you expect
|
||||
on a non case sensitive operating system (such as Windows).
|
||||
<example>
|
||||
<title><function>require_once</function> is case sensitive</title>
|
||||
<programlisting role="php">
|
||||
<para>
|
||||
<note>
|
||||
<para>
|
||||
<function>require_once</function> was added in PHP 4.0.1pl2
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
<para>
|
||||
<note>
|
||||
<para>
|
||||
Be aware, that the behaviour of <function>require_once</function>
|
||||
and <function>include_once</function> may not be what you expect
|
||||
on a non case sensitive operating system (such as Windows).
|
||||
<example>
|
||||
<title><function>require_once</function> is case sensitive</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
require_once("a.php"); // this will include a.php
|
||||
require_once("A.php"); // this will include a.php again on Windows!
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</note>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
&warn.no-win32-fopen-wrapper;
|
||||
<para>
|
||||
See also: <function>require</function>,
|
||||
|
@ -1491,34 +1503,38 @@ require_once("A.php"); // this will include a.php again on Windows!
|
|||
variable value reassignments, etc.
|
||||
</para>
|
||||
<para>
|
||||
For more examples on using <function>require_once</function> and
|
||||
<function>include_once</function>, look at the
|
||||
<ulink url="&url.php.pear;">PEAR</ulink> code included in the latest
|
||||
PHP source code distributions.
|
||||
For more examples on using <function>require_once</function> and
|
||||
<function>include_once</function>, look at the
|
||||
<ulink url="&url.php.pear;">PEAR</ulink> code included in the latest
|
||||
PHP source code distributions.
|
||||
</para>
|
||||
<para>
|
||||
<note>
|
||||
<para>
|
||||
<function>include_once</function> was added in PHP 4.0.1pl2
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
<para>
|
||||
<note>
|
||||
<para>
|
||||
<function>include_once</function> was added in PHP 4.0.1pl2
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
Be aware, that the behaviour of <function>include_once</function>
|
||||
and <function>require_once</function> may not be what you expect
|
||||
on a non case sensitive operating system (such as Windows).
|
||||
<example>
|
||||
<title><function>include_once</function> is case sensitive</title>
|
||||
<programlisting role="php">
|
||||
<para>
|
||||
Be aware, that the behaviour of <function>include_once</function>
|
||||
and <function>require_once</function> may not be what you expect
|
||||
on a non case sensitive operating system (such as Windows).
|
||||
<example>
|
||||
<title><function>include_once</function> is case sensitive</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
include_once("a.php"); // this will include a.php
|
||||
include_once("A.php"); // this will include a.php again on Windows!
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</note>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
&warn.no-win32-fopen-wrapper;
|
||||
<para>
|
||||
See also <function>include</function>,
|
||||
|
|
Loading…
Reference in a new issue