cvs: phpdoc /en/language expressions.xml oop.xml operators.xml references.xml variables.xml /en/language/control-structures do-while.xml
/en/language/oop5 iterations.xml reflection.xml /en/reference/apache/functions virtual.xml /en/reference/apc ini.xml

From: Date: Sun, 03 May 2009 10:58:35 +0000
Subject: cvs: phpdoc /en/language expressions.xml oop.xml operators.xml references.xml variables.xml /en/language/control-structures do-while.xml
/en/language/oop5 iterations.xml reflection.xml /en/reference/apache/functions virtual.xml /en/reference/apc ini.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-3939@lists.php.net to get a copy of this message
yannick Sun May 3 10:58:35 2009 UTC Modified files: /phpdoc/en/reference/apc ini.xml /phpdoc/en/reference/apache/functions virtual.xml /phpdoc/en/language/oop5 iterations.xml reflection.xml /phpdoc/en/language/control-structures do-while.xml /phpdoc/en/language operators.xml references.xml expressions.xml variables.xml oop.xml Log: fix markup

http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/apc/ini.xml?r1=1.24&r2=1.25&diff_format=u Index: phpdoc/en/reference/apc/ini.xml diff -u phpdoc/en/reference/apc/ini.xml:1.24 phpdoc/en/reference/apc/ini.xml:1.25 --- phpdoc/en/reference/apc/ini.xml:1.24 Thu Apr 16 19:02:05 2009 +++ phpdoc/en/reference/apc/ini.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.24 $ --> +<!-- $Revision: 1.25 $ --> <section xml:id="apc.configuration" xmlns="http://docbook.org/ns/docbook"> &reftitle.runtime; &extension.runtime; @@ -457,7 +457,8 @@ When you modify a file on a live web server you really should do so in an atomic manner. That is, write to a temporary file and rename (<literal>mv</literal>) the file into its - permanent position when it is ready. Many text editors, cp, tar and + permanent position when it is ready. Many text editors, + <command>cp</command>, <command>tar</command> and other such programs don't do this. This means that there is a chance that a file is accessed (and cached) while it is still being written to. This <literal>apc.file_update_protection</literal> @@ -468,7 +469,7 @@ The unfortunate person who accessed this half-written file will still see weirdness, but at least it won't persist. If you are certain you always atomically update your files - by using something like rsync which does this correctly, you + by using something like <command>rsync</command> which does this correctly, you can turn this protection off by setting it to 0. If you have a system that is flooded with io causing some update procedure to take longer than 2 seconds, you may want to @@ -657,7 +658,8 @@ <para> The frequency that updates should be made to the user cache entry for upload progress. This can take the form of a percentage of the total - file size or a size in bytes optionally suffixed with 'k', 'm', or 'g' + file size or a size in bytes optionally suffixed with + <literal>"k"</literal>, <literal>"m"</literal>, or <literal>"g"</literal> for kilobytes, megabytes, or gigabytes respectively (case insensitive). A setting of 0 updates as often as possible, which may cause slower uploads. http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/apache/functions/virtual.xml?r1=1.16&r2=1.17&diff_format=u Index: phpdoc/en/reference/apache/functions/virtual.xml diff -u phpdoc/en/reference/apache/functions/virtual.xml:1.16 phpdoc/en/reference/apache/functions/virtual.xml:1.17 --- phpdoc/en/reference/apache/functions/virtual.xml:1.16 Mon Dec 31 00:32:08 2007 +++ phpdoc/en/reference/apache/functions/virtual.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <!-- splitted from ./en/functions/apache.xml, last change in rev 1.20 --> <refentry xml:id="function.virtual" xmlns="http://docbook.org/ns/docbook"> <refnamediv> @@ -15,12 +15,13 @@ </methodsynopsis> <para> <function>virtual</function> is an Apache-specific function which - is similar to <literal>&lt;!--#include virtual...--&gt;</literal> in mod_include. + is similar to <literal>&lt;!--#include virtual...--&gt;</literal> in + <literal>mod_include</literal>. It performs an Apache sub-request. It is useful for including - CGI scripts or .shtml files, or anything else that you would - parse through Apache. Note that for a CGI script, the script + CGI scripts or <filename>.shtml</filename> files, or anything else that you would + parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it - must generate a Content-type header. + must generate a <literal>Content-Type</literal> header. </para> <para> To run the sub-request, all buffers are terminated and flushed to the http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop5/iterations.xml?r1=1.14&r2=1.15&diff_format=u Index: phpdoc/en/language/oop5/iterations.xml diff -u phpdoc/en/language/oop5/iterations.xml:1.14 phpdoc/en/language/oop5/iterations.xml:1.15 --- phpdoc/en/language/oop5/iterations.xml:1.14 Mon Feb 16 15:30:17 2009 +++ phpdoc/en/language/oop5/iterations.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <sect1 xml:id="language.oop5.iterations" xmlns="http://docbook.org/ns/docbook"> <title>Object Iteration</title> <para> @@ -67,7 +67,7 @@ <para> As the output shows, the &foreach; iterated through all <link linkend="language.oop5.visibility">visible</link> variables that can be - accessed. To take it a step further you can <varname>implement</varname> one + accessed. To take it a step further you can implement one of PHP 5's internal <link linkend="language.oop5.interfaces">interface</link> named <varname>Iterator</varname>. This allows the object to decide what and how http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop5/reflection.xml?r1=1.39&r2=1.40&diff_format=u Index: phpdoc/en/language/oop5/reflection.xml diff -u phpdoc/en/language/oop5/reflection.xml:1.39 phpdoc/en/language/oop5/reflection.xml:1.40 --- phpdoc/en/language/oop5/reflection.xml:1.39 Tue Nov 4 15:49:10 2008 +++ phpdoc/en/language/oop5/reflection.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.39 $ --> +<!-- $Revision: 1.40 $ --> <sect1 xml:id="language.oop5.reflection" xmlns="http://docbook.org/ns/docbook"> <title>Reflection</title> <sect2 xml:id="language.oop5.reflection.toc"> @@ -22,7 +22,7 @@ <title>Introduction</title> <para> PHP 5 comes with a complete reflection API that adds the ability to - reverse-engineer classes, interfaces, functions and methods as well + <literal>reverse-engineer</literal> classes, interfaces, functions and methods as well as extensions. Additionally, the reflection API also offers ways of retrieving doc comments for functions, classes and methods. </para> @@ -161,7 +161,7 @@ <title><classname>ReflectionFunction</classname></title> <para> The <classname>ReflectionFunction</classname> class lets you - reverse-engineer functions. + <literal>reverse-engineer</literal> functions. </para> <informalexample> <programlisting role="php"> @@ -363,7 +363,7 @@ <title><classname>ReflectionClass</classname></title> <para> The <classname>ReflectionClass</classname> class lets - you reverse-engineer classes and interfaces. + you <literal>reverse-engineer</literal> classes and interfaces. </para> <informalexample> <programlisting role="php"> @@ -557,7 +557,7 @@ <title><classname>ReflectionMethod</classname></title> <para> The <classname>ReflectionMethod</classname> class lets you - reverse-engineer class methods. + <literal>reverse-engineer</literal> class methods. </para> <informalexample> <programlisting role="php"> @@ -710,7 +710,7 @@ <title><classname>ReflectionProperty</classname></title> <para> The <classname>ReflectionProperty</classname> class lets you - reverse-engineer class properties. + <literal>reverse-engineer</literal> class properties. </para> <informalexample> <programlisting role="php"> @@ -832,7 +832,7 @@ <title><classname>ReflectionExtension</classname></title> <para> The <classname>ReflectionExtension</classname> class lets you - reverse-engineer extensions. You can retrieve all loaded extensions + <literal>reverse-engineer</literal> extensions. You can retrieve all loaded extensions at runtime using the <function>get_loaded_extensions</function>. </para> <informalexample> @@ -949,8 +949,8 @@ </example> <note> <simpara> - Caution: If you're overwriting the constructor, remember to call - the parent's constructor _before_ any code you insert. Failing to + <emphasis>Caution</emphasis>: If you're overwriting the constructor, remember to call + the parent's constructor <emphasis>before</emphasis>any code you insert. Failing to do so will result in the following: <literal> Fatal error: Internal error: Failed to retrieve the reflection object http://cvs.php.net/viewvc.cgi/phpdoc/en/language/control-structures/do-while.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/language/control-structures/do-while.xml diff -u phpdoc/en/language/control-structures/do-while.xml:1.1 phpdoc/en/language/control-structures/do-while.xml:1.2 --- phpdoc/en/language/control-structures/do-while.xml:1.1 Sat Dec 27 01:35:49 2008 +++ phpdoc/en/language/control-structures/do-while.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <sect1 xml:id="control-structures.do.while" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title><literal>do-while</literal></title> @@ -35,7 +35,7 @@ <simpara> The above loop would run one time exactly, since after the first iteration, when truth expression is checked, it evaluates to - &false; ($i is not bigger than 0) and the loop + &false; (<varname>$i</varname> is not bigger than 0) and the loop execution ends. </simpara> <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/operators.xml?r1=1.142&r2=1.143&diff_format=u Index: phpdoc/en/language/operators.xml diff -u phpdoc/en/language/operators.xml:1.142 phpdoc/en/language/operators.xml:1.143 --- phpdoc/en/language/operators.xml:1.142 Sun Apr 19 03:18:19 2009 +++ phpdoc/en/language/operators.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.142 $ --> +<!-- $Revision: 1.143 $ --> <chapter xml:id="language.operators" xmlns="http://docbook.org/ns/docbook"> <title>Operators</title> <simpara> @@ -258,32 +258,32 @@ <row> <entry>-$a</entry> <entry>Negation</entry> - <entry>Opposite of $a.</entry> + <entry>Opposite of <varname>$a</varname>.</entry> </row> <row> <entry>$a + $b</entry> <entry>Addition</entry> - <entry>Sum of $a and $b.</entry> + <entry>Sum of <varname>$a</varname> and <varname>$b</varname>.</entry> </row> <row> <entry>$a - $b</entry> <entry>Subtraction</entry> - <entry>Difference of $a and $b.</entry> + <entry>Difference of <varname>$a</varname> and <varname>$b</varname>.</entry> </row> <row> <entry>$a * $b</entry> <entry>Multiplication</entry> - <entry>Product of $a and $b.</entry> + <entry>Product of <varname>$a</varname> and <varname>$b</varname>.</entry> </row> <row> <entry>$a / $b</entry> <entry>Division</entry> - <entry>Quotient of $a and $b.</entry> + <entry>Quotient of <varname>$a</varname> and <varname>$b</varname>.</entry> </row> <row> <entry>$a % $b</entry> <entry>Modulus</entry> - <entry>Remainder of $a divided by $b.</entry> + <entry>Remainder of <varname>$a</varname> divided by <varname>$b</varname>.</entry> </row> </tbody> </tgroup> @@ -320,7 +320,7 @@ </simpara> <para> The value of an assignment expression is the value assigned. That - is, the value of "$a = 3" is 3. This allows you to do some tricky + is, the value of "<literal>$a = 3</literal>" is 3. This allows you to do some tricky things: <informalexample> <programlisting role="php"> @@ -392,32 +392,32 @@ <row> <entry><userinput>$a &amp; $b</userinput></entry> <entry>And</entry> - <entry>Bits that are set in both $a and $b are set.</entry> + <entry>Bits that are set in both <varname>$a</varname> and <varname>$b</varname> are set.</entry> </row> <row> <entry><userinput>$a | $b</userinput></entry> <entry>Or (inclusive or)</entry> - <entry>Bits that are set in either $a or $b are set.</entry> + <entry>Bits that are set in either <varname>$a</varname> or <varname>$b</varname> are set.</entry> </row> <row> <entry><userinput>$a ^ $b</userinput></entry> <entry>Xor (exclusive or)</entry> <entry> - Bits that are set in $a or $b but not both are set. + Bits that are set in <varname>$a</varname> or <varname>$b</varname> but not both are set. </entry> </row> <row> <entry><userinput>~ $a</userinput></entry> <entry>Not</entry> <entry> - Bits that are set in $a are not set, and vice versa. + Bits that are set in <varname>$a</varname> are not set, and vice versa. </entry> </row> <row> <entry><userinput>$a &lt;&lt; $b</userinput></entry> <entry>Shift left</entry> <entry> - Shift the bits of $a $b steps to the left (each step means + Shift the bits of <varname>$a</varname> <varname>$b</varname> steps to the left (each step means "multiply by two") </entry> </row> @@ -425,7 +425,7 @@ <entry><userinput>$a &gt;&gt; $b</userinput></entry> <entry>Shift right</entry> <entry> - Shift the bits of $a $b steps to the right (each step means + Shift the bits of <varname>$a</varname> <varname>$b</varname> steps to the right (each step means "divide by two") </entry> </row> @@ -1044,53 +1044,53 @@ <row> <entry>$a == $b</entry> <entry>Equal</entry> - <entry>&true; if $a is equal to $b.</entry> + <entry>&true; if <varname>$a</varname> is equal to <varname>$b</varname>.</entry> </row> <row> <entry>$a === $b</entry> <entry>Identical</entry> <entry> - &true; if $a is equal to $b, and they are of the same + &true; if <varname>$a</varname> is equal to <varname>$b</varname>, and they are of the same type. (introduced in PHP 4) </entry> </row> <row> <entry>$a != $b</entry> <entry>Not equal</entry> - <entry>&true; if $a is not equal to $b.</entry> + <entry>&true; if <varname>$a</varname> is not equal to <varname>$b</varname>.</entry> </row> <row> <entry>$a &lt;&gt; $b</entry> <entry>Not equal</entry> - <entry>&true; if $a is not equal to $b.</entry> + <entry>&true; if <varname>$a</varname> is not equal to <varname>$b</varname>.</entry> </row> <row> <entry>$a !== $b</entry> <entry>Not identical</entry> <entry> - &true; if $a is not equal to $b, or they are not of the same + &true; if <varname>$a</varname> is not equal to <varname>$b</varname>, or they are not of the same type. (introduced in PHP 4) </entry> </row> <row> <entry>$a &lt; $b</entry> <entry>Less than</entry> - <entry>&true; if $a is strictly less than $b.</entry> + <entry>&true; if <varname>$a</varname> is strictly less than <varname>$b</varname>.</entry> </row> <row> <entry>$a &gt; $b</entry> <entry>Greater than</entry> - <entry>&true; if $a is strictly greater than $b.</entry> + <entry>&true; if <varname>$a</varname> is strictly greater than <varname>$b</varname>.</entry> </row> <row> <entry>$a &lt;= $b</entry> <entry>Less than or equal to </entry> - <entry>&true; if $a is less than or equal to $b.</entry> + <entry>&true; if <varname>$a</varname> is less than or equal to <varname>$b</varname>.</entry> </row> <row> <entry>$a &gt;= $b</entry> <entry>Greater than or equal to </entry> - <entry>&true; if $a is greater than or equal to $b.</entry> + <entry>&true; if <varname>$a</varname> is greater than or equal to <varname>$b</varname>.</entry> </row> </tbody> </tgroup> @@ -1421,22 +1421,22 @@ <row> <entry>++$a</entry> <entry>Pre-increment</entry> - <entry>Increments $a by one, then returns $a.</entry> + <entry>Increments <varname>$a</varname> by one, then returns <varname>$a</varname>.</entry> </row> <row> <entry>$a++</entry> <entry>Post-increment</entry> - <entry>Returns $a, then increments $a by one.</entry> + <entry>Returns <varname>$a</varname>, then increments <varname>$a</varname> by one.</entry> </row> <row> <entry>--$a</entry> <entry>Pre-decrement</entry> - <entry>Decrements $a by one, then returns $a.</entry> + <entry>Decrements <varname>$a</varname> by one, then returns <varname>$a</varname>.</entry> </row> <row> <entry>$a--</entry> <entry>Post-decrement</entry> - <entry>Returns $a, then decrements $a by one.</entry> + <entry>Returns <varname>$a</varname>, then decrements <varname>$a</varname> by one.</entry> </row> </tbody> </tgroup> @@ -1473,8 +1473,10 @@ </para> <para> PHP follows Perl's convention when dealing with arithmetic operations - on character variables and not C's. For example, in Perl 'Z'+1 turns - into 'AA', while in C 'Z'+1 turns into '[' ( ord('Z') == 90, ord('[') == 91 ). + on character variables and not C's. For example, in Perl + <literal>'Z'+1</literal> turns into <literal>'AA'</literal>, while in C + <literal>'Z'+1</literal> turns into <literal>'['</literal> + ( <literal>ord('Z') == 90</literal>, <literal>ord('[') == 91</literal> ). Note that character variables can be incremented but not decremented and even so only plain ASCII characters (a-z and A-Z) are supported. <example> @@ -1524,32 +1526,32 @@ <row> <entry>$a and $b</entry> <entry>And</entry> - <entry>&true; if both $a and $b are &true;.</entry> + <entry>&true; if both <varname>$a</varname> and <varname>$b</varname> are &true;.</entry> </row> <row> <entry>$a or $b</entry> <entry>Or</entry> - <entry>&true; if either $a or $b is &true;.</entry> + <entry>&true; if either <varname>$a</varname> or <varname>$b</varname> is &true;.</entry> </row> <row> <entry>$a xor $b</entry> <entry>Xor</entry> - <entry>&true; if either $a or $b is &true;, but not both.</entry> + <entry>&true; if either <varname>$a</varname> or <varname>$b</varname> is &true;, but not both.</entry> </row> <row> <entry>! $a</entry> <entry>Not</entry> - <entry>&true; if $a is not &true;.</entry> + <entry>&true; if <varname>$a</varname> is not &true;.</entry> </row> <row> <entry>$a &amp;&amp; $b</entry> <entry>And</entry> - <entry>&true; if both $a and $b are &true;.</entry> + <entry>&true; if both <varname>$a</varname> and <varname>$b</varname> are &true;.</entry> </row> <row> <entry>$a || $b</entry> <entry>Or</entry> - <entry>&true; if either $a or $b is &true;.</entry> + <entry>&true; if either <varname>$a</varname> or <varname>$b</varname> is &true;.</entry> </row> </tbody> </tgroup> @@ -1602,7 +1604,7 @@ There are two <type>string</type> operators. The first is the concatenation operator ('.'), which returns the concatenation of its right and left arguments. The second is the concatenating assignment - operator ('.='), which appends the argument on the right side to + operator ('<literal>.=</literal>'), which appends the argument on the right side to the argument on the left side. Please read <link linkend="language.operators.assignment">Assignment Operators</link> for more information. @@ -1646,33 +1648,33 @@ <row> <entry>$a + $b</entry> <entry>Union</entry> - <entry>Union of $a and $b.</entry> + <entry>Union of <varname>$a</varname> and <varname>$b</varname>.</entry> </row> <row> <entry>$a == $b</entry> <entry>Equality</entry> - <entry>&true; if $a and $b have the same key/value pairs.</entry> + <entry>&true; if <varname>$a</varname> and <varname>$b</varname> have the same key/value pairs.</entry> </row> <row> <entry>$a === $b</entry> <entry>Identity</entry> - <entry>&true; if $a and $b have the same key/value pairs in the same + <entry>&true; if <varname>$a</varname> and <varname>$b</varname> have the same key/value pairs in the same order and of the same types.</entry> </row> <row> <entry>$a != $b</entry> <entry>Inequality</entry> - <entry>&true; if $a is not equal to $b.</entry> + <entry>&true; if <varname>$a</varname> is not equal to <varname>$b</varname>.</entry> </row> <row> <entry>$a &lt;&gt; $b</entry> <entry>Inequality</entry> - <entry>&true; if $a is not equal to $b.</entry> + <entry>&true; if <varname>$a</varname> is not equal to <varname>$b</varname>.</entry> </row> <row> <entry>$a !== $b</entry> <entry>Non-identity</entry> - <entry>&true; if $a is not identical to $b.</entry> + <entry>&true; if <varname>$a</varname> is not identical to <varname>$b</varname>.</entry> </row> </tbody> </tgroup> @@ -1789,7 +1791,7 @@ <literal>instanceof</literal> can also be used to determine whether a variable is an instantiated object of a class that inherits from a parent class: <example> - <title>Using instanceof with inherited classes</title> + <title>Using <literal>instanceof</literal> with inherited classes</title> <programlisting role="php"> <![CDATA[ <?php @@ -1822,7 +1824,7 @@ <link linkend="language.operators.logical">logical <literal>not</literal> operator</link> can be used. <example> - <title>Using instanceof to check if object is <emphasis>not</emphasis> an + <title>Using <literal>instanceof</literal> to check if object is <emphasis>not</emphasis> an instanceof a class</title> <programlisting role="php"> <![CDATA[ @@ -1849,7 +1851,7 @@ a variable is an instantiated object of a class that implements an <link linkend="language.oop5.interfaces">interface</link>: <example> - <title>Using instanceof for class</title> + <title>Using <literal>instanceof</literal> for class</title> <programlisting role="php"> <![CDATA[ <?php @@ -1881,7 +1883,7 @@ Although <literal>instanceof</literal> is usually used with a literal classname, it can also be used with another object or a string variable: <example> - <title>Using instanceof with other variables</title> + <title>Using <literal>instanceof</literal> with other variables</title> <programlisting role="php"> <![CDATA[ <?php @@ -1918,10 +1920,10 @@ There are a few pitfalls to be aware of. Before PHP version 5.1.0, <literal>instanceof</literal> would call <link linkend="language.oop5.autoload">__autoload()</link> if the class name did not exist. In addition, if the class was not loaded, - a fatal error would occur. This can be worked around by using a <literal>dynamic - class reference</literal>, or a string variable containing the class name: + a fatal error would occur. This can be worked around by using a dynamic + class reference, or a string variable containing the class name: <example> - <title>Avoiding classname lookups and fatal errors with instanceof in PHP 5.0</title> + <title>Avoiding classname lookups and fatal errors with <literal>instanceof</literal> in PHP 5.0</title> <programlisting role="php"> <![CDATA[ <?php http://cvs.php.net/viewvc.cgi/phpdoc/en/language/references.xml?r1=1.52&r2=1.53&diff_format=u Index: phpdoc/en/language/references.xml diff -u phpdoc/en/language/references.xml:1.52 phpdoc/en/language/references.xml:1.53 --- phpdoc/en/language/references.xml:1.52 Thu Apr 16 19:46:35 2009 +++ phpdoc/en/language/references.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.52 $ --> +<!-- $Revision: 1.53 $ --> <chapter xml:id="language.references" xmlns="http://docbook.org/ns/docbook"> <title>References Explained</title> @@ -90,7 +90,7 @@ </informalexample> Since PHP 5, <link linkend="language.oop5.basic.new">new</link> returns a reference automatically, so using <literal>=&amp;</literal> in this - context is deprecated and produces an E_STRICT message. + context is deprecated and produces an <constant>E_STRICT</constant> message. </para> <note> <para> @@ -413,7 +413,7 @@ </simpara> <sect2 xml:id="references.global"> - <title><literal>global</literal> References</title> + <title>global References</title> <para> When you declare a variable as <command>global $var</command> you are in fact creating reference to a global variable. That means, http://cvs.php.net/viewvc.cgi/phpdoc/en/language/expressions.xml?r1=1.32&r2=1.33&diff_format=u Index: phpdoc/en/language/expressions.xml diff -u phpdoc/en/language/expressions.xml:1.32 phpdoc/en/language/expressions.xml:1.33 --- phpdoc/en/language/expressions.xml:1.32 Tue Nov 18 16:05:09 2008 +++ phpdoc/en/language/expressions.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.32 $ --> +<!-- $Revision: 1.33 $ --> <chapter xml:id="language.expressions" xmlns="http://docbook.org/ns/docbook"> <title>Expressions</title> <simpara> @@ -10,14 +10,15 @@ </simpara> <simpara> The most basic forms of expressions are constants and variables. - When you type "$a = 5", you're assigning '5' into $a. '5', obviously, + When you type "<varname>$a</varname> = 5", you're assigning '5' into + <varname>$a</varname>. '5', obviously, has the value 5, or in other words '5' is an expression with the value of 5 (in this case, '5' is an integer constant). </simpara> <simpara> - After this assignment, you'd expect $a's value to be 5 as - well, so if you wrote $b = $a, you'd expect it to behave just as - if you wrote $b = 5. In other words, $a is an expression with the + After this assignment, you'd expect <varname>$a</varname>'s value to be 5 as + well, so if you wrote <varname>$b</varname> = <varname>$a</varname>, you'd expect it to behave just as + if you wrote <varname>$b</varname> = 5. In other words, <varname>$a</varname> is an expression with the value of 5 as well. If everything works right, this is exactly what will happen. </simpara> @@ -43,8 +44,8 @@ linkend="language.functions">functions</link>), you'd assume that typing <literal>$c = foo()</literal> is essentially just like writing <literal>$c = 5</literal>, and you're right. Functions - are expressions with the value of their return value. Since foo() - returns 5, the value of the expression 'foo()' is 5. Usually + are expressions with the value of their return value. Since <literal>foo()</literal> + returns 5, the value of the expression '<literal>foo()</literal>' is 5. Usually functions don't just return a static value but compute something. </simpara> <simpara> @@ -60,25 +61,26 @@ PHP takes expressions much further, in the same way many other languages do. PHP is an expression-oriented language, in the sense that almost everything is an expression. Consider the - example we've already dealt with, '$a = 5'. It's easy to see that + example we've already dealt with, '<varname>$a</varname> = 5'. It's easy to see that there are two values involved here, the value of the integer - constant '5', and the value of $a which is being updated to 5 as + constant '5', and the value of <varname>$a</varname> which is being updated to 5 as well. But the truth is that there's one additional value involved here, and that's the value of the assignment itself. The assignment itself evaluates to the assigned value, in this case 5. - In practice, it means that '$a = 5', regardless of what it does, + In practice, it means that '<varname>$a</varname> = 5', regardless of what it does, is an expression with the value 5. Thus, writing something like - '$b = ($a = 5)' is like writing '$a = 5; $b = 5;' (a semicolon + '<varname>$b</varname> = (<varname>$a</varname> = 5)' is like writing + '<varname>$a</varname> = 5; <varname>$b</varname> = 5;' (a semicolon marks the end of a statement). Since assignments are parsed in a - right to left order, you can also write '$b = $a = 5'. + right to left order, you can also write '<varname>$b</varname> = <varname>$a</varname> = 5'. </simpara> <simpara> Another good example of expression orientation is pre- and post-increment and decrement. Users of PHP and many other - languages may be familiar with the notation of variable++ and - variable--. These are <link linkend="language.operators.increment"> + languages may be familiar with the notation of <literal>variable++</literal> and + <literal>variable--</literal>. These are <link linkend="language.operators.increment"> increment and decrement operators</link>. In - PHP/FI 2, the statement '$a++' has no value (is not an + PHP/FI 2, the statement '<varname>$a</varname>++' has no value (is not an expression), and thus you can't assign it or use it in any way. PHP enhances the increment/decrement capabilities by making these expressions as well, like in C. In PHP, like in C, there @@ -86,10 +88,10 @@ Both pre-increment and post-increment essentially increment the variable, and the effect on the variable is identical. The difference is with the value of the increment expression. - Pre-increment, which is written '++$variable', evaluates to the + Pre-increment, which is written '++<varname>$variable</varname>', evaluates to the incremented value (PHP increments the variable before reading its value, thus the name 'pre-increment'). Post-increment, which is - written '$variable++' evaluates to the original value of + written '<varname>$variable</varname>++' evaluates to the original value of $variable, before it was incremented (PHP increments the variable after reading its value, thus the name 'post-increment'). </simpara> @@ -107,24 +109,29 @@ <simpara> The last example of expressions we'll deal with here is combined operator-assignment expressions. You already know that if you - want to increment $a by 1, you can simply write '$a++' or '++$a'. + want to increment <varname>$a</varname> by 1, you can simply write + '<varname>$a</varname>++' or '++<varname>$a</varname>'. But what if you want to add more than one to it, for instance 3? - You could write '$a++' multiple times, but this is obviously not a - very efficient or comfortable way. A much more common practice is - to write '$a = $a + 3'. '$a + 3' evaluates to the value of $a - plus 3, and is assigned back into $a, which results in - incrementing $a by 3. In PHP, as in several other languages - like C, you can write this in a shorter way, which with time would - become clearer and quicker to understand as well. Adding 3 to the - current value of $a can be written '$a += 3'. This means exactly - "take the value of $a, add 3 to it, and assign it back into $a". - In addition to being shorter and clearer, this also results in - faster execution. The value of '$a += 3', like the value of a - regular assignment, is the assigned value. Notice that it is NOT - 3, but the combined value of $a plus 3 (this is the value that's - assigned into $a). Any two-place operator can be used in this - operator-assignment mode, for example '$a -= 5' (subtract 5 from - the value of $a), '$b *= 7' (multiply the value of $b by 7), etc. + You could write '<varname>$a</varname>++' multiple times, but this + is obviously not a very efficient or comfortable way. A much more + common practice is to write '<varname>$a</varname> = + <varname>$a</varname> + 3'. '<varname>$a</varname> + 3' evaluates + to the value of <varname>$a</varname> plus 3, and is assigned back + into <varname>$a</varname>, which results in incrementing <varname>$a</varname> + by 3. In PHP, as in several other languages like C, you can write this + in a shorter way, which with time would become clearer and quicker to + understand as well. Adding 3 to the current value of <varname>$a</varname> + can be written '<varname>$a</varname> += 3'. This means exactly + "take the value of <varname>$a</varname>, add 3 to it, and assign it + back into <varname>$a</varname>". In addition to being shorter and + clearer, this also results in faster execution. The value of + '<varname>$a</varname> += 3', like the value of a regular assignment, is + the assigned value. Notice that it is NOT 3, but the combined value + of <varname>$a</varname> plus 3 (this is the value that's + assigned into <varname>$a</varname>). Any two-place operator can be used + in this operator-assignment mode, for example '<varname>$a</varname> -= 5' + (subtract 5 from the value of <varname>$a</varname>), '<varname>$b</varname> *= 7' + (multiply the value of <varname>$b</varname> by 7), etc. </simpara> <para> There is one more expression that may seem odd if you haven't seen @@ -183,10 +190,10 @@ </para> <simpara> Some expressions can be considered as statements. In - this case, a statement has the form of 'expr' ';' that is, an - expression followed by a semicolon. In '$b=$a=5;', $a=5 is a - valid expression, but it's not a statement by itself. '$b=$a=5;' - however is a valid statement. + this case, a statement has the form of '<literal>expr ;</literal>' that is, an + expression followed by a semicolon. In <literal>'$b = $a = 5;'</literal>, + <literal>'$a = 5'</literal> is a valid expression, but it's not a statement + by itself. <literal>'$b = $a = 5;'</literal> however is a valid statement. </simpara> <simpara> One last thing worth mentioning is the truth value of expressions. http://cvs.php.net/viewvc.cgi/phpdoc/en/language/variables.xml?r1=1.109&r2=1.110&diff_format=u Index: phpdoc/en/language/variables.xml diff -u phpdoc/en/language/variables.xml:1.109 phpdoc/en/language/variables.xml:1.110 --- phpdoc/en/language/variables.xml:1.109 Mon Apr 27 15:38:01 2009 +++ phpdoc/en/language/variables.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- $Revision: 1.109 $ --> +<!-- $Revision: 1.110 $ --> <chapter xml:id="language.variables" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Variables</title> @@ -16,13 +16,13 @@ valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: - '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' + '<literal>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*</literal>' </para> <note> <simpara> For our purposes here, a letter is a-z, A-Z, and the bytes - from 127 through 255 (0x7f-0xff). + from 127 through 255 (<literal>0x7f-0xff</literal>). </simpara> </note> @@ -78,8 +78,8 @@ <para> To assign by reference, simply prepend an ampersand (&amp;) to the beginning of the variable which is being assigned (the source - variable). For instance, the following code snippet outputs 'My - name is Bob' twice: + variable). For instance, the following code snippet outputs '<literal>My + name is Bob</literal>' twice: <informalexample> <programlisting role="php"> @@ -246,7 +246,7 @@ <note> <para> - Even though both the superglobal and HTTP_*_VARS can exist at the same + Even though both the superglobal and <literal>HTTP_*_VARS</literal> can exist at the same time; they are not identical, so modifying one will not change the other. </para> </note> @@ -317,13 +317,13 @@ </simpara> <sect2 xml:id="language.variables.scope.global"> - <title>The global keyword</title> + <title>The <literal>global</literal> keyword</title> <simpara> First, an example use of <literal>global</literal>: </simpara> <para> <example> - <title>Using global</title> + <title>Using <literal>global</literal></title> <programlisting role="php"> <![CDATA[ <?php @@ -346,7 +346,7 @@ </para> <simpara> - The above script will output &quot;3&quot;. By declaring + The above script will output <literal>3</literal>. By declaring <varname>$a</varname> and <varname>$b</varname> global within the function, all references to either variable will refer to the global version. There is no limit to the number of global @@ -385,7 +385,7 @@ the name of the global variable being the key and the contents of that variable being the value of the array element. Notice how <varname>$GLOBALS</varname> exists in any scope, this - is because $GLOBALS is a <link + is because <varname>$GLOBALS</varname> is a <link linkend="language.variables.superglobals">superglobal</link>. Here's an example demonstrating the power of superglobals: </simpara> @@ -417,7 +417,7 @@ </sect2> <sect2 xml:id="language.variables.scope.static"> - <title>Using static variables</title> + <title>Using <literal>static</literal> variables</title> <simpara> Another important feature of variable scoping is the <emphasis>static</emphasis> variable. A static variable exists @@ -445,7 +445,7 @@ <simpara> This function is quite useless since every time it is called it sets <varname>$a</varname> to <literal>0</literal> and prints - &quot;0&quot;. The <varname>$a</varname>++ which increments the + <literal>0</literal>. The <varname>$a</varname>++ which increments the variable serves no purpose since as soon as the function exits the <varname>$a</varname> variable disappears. To make a useful counting function which will not lose track of the current count, @@ -470,7 +470,7 @@ </para> <simpara> Now, <varname>$a</varname> is initialized only in first call of function - and every time the test() function is called it will print the + and every time the <literal>test()</literal> function is called it will print the value of <varname>$a</varname> and increment it. </simpara> @@ -535,7 +535,7 @@ </sect2> <sect2 xml:id="language.variables.scope.references"> - <title>References with global and static variables</title> + <title>References with <literal>global</literal> and <literal>static</literal> variables</title> <simpara> The Zend Engine 1, driving PHP 4, implements the <link linkend="language.variables.scope.static">static</link> and @@ -570,9 +570,7 @@ </programlisting> </informalexample> - <simpara> - Executing this example will result in the following output: - </simpara> + &example.outputs; <screen> NULL @@ -624,11 +622,7 @@ ]]> </programlisting> </informalexample> - - <simpara> - Executing this example will result in the following output: - </simpara> - + &example.outputs; <screen> Static object: NULL Static object: NULL @@ -804,8 +798,8 @@ </para> <para> Using a GET form is similar except you'll use the appropriate - GET predefined variable instead. GET also applies to the - QUERY_STRING (the information after the '?' in a URL). So, + GET predefined variable instead. GET also applies to the + <literal>QUERY_STRING</literal> (the information after the '?' in a URL). So, for example, <literal>http://www.example.com/test.php?id=3</literal> contains GET data which is accessible with <varname>$_GET['id']</varname>. See also <varname>$_REQUEST</varname> and @@ -896,7 +890,8 @@ <simpara> When the user clicks somewhere on the image, the accompanying form will be transmitted to the server with two additional - variables, sub_x and sub_y. These contain the coordinates of the + variables, <varname>sub_x</varname> and <varname>sub_y</varname>. + These contain the coordinates of the user click within the image. The experienced may note that the actual variable names sent by the browser contains a period rather than an underscore, but PHP converts the period to an @@ -942,7 +937,7 @@ </informalexample> <simpara> - That will create two separate cookies although MyCookie will now + That will create two separate cookies although <varname>MyCookie</varname> will now be a single array in your script. If you want to set just one cookie with multiple values, consider using <function>serialize</function> or <function>explode</function> on the value first. http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop.xml?r1=1.72&r2=1.73&diff_format=u Index: phpdoc/en/language/oop.xml diff -u phpdoc/en/language/oop.xml:1.72 phpdoc/en/language/oop.xml:1.73 --- phpdoc/en/language/oop.xml:1.72 Fri Apr 3 10:49:11 2009 +++ phpdoc/en/language/oop.xml Sun May 3 10:58:35 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.72 $ --> +<!-- $Revision: 1.73 $ --> <chapter xml:id="language.oop" xmlns="http://docbook.org/ns/docbook"> <title>Classes and Objects (PHP 4)</title> @@ -121,9 +121,9 @@ <caution> <simpara> - PHP reserves all function names starting with __ as magical. + PHP reserves all function names starting with <literal>__</literal> as magical. It is recommended that you do not use function names with - __ in PHP unless you want some documented magic functionality. + <literal>__</literal> in PHP unless you want some documented magic functionality. </simpara> </caution> @@ -188,27 +188,28 @@ <para> This creates the objects <varname>$cart</varname> and <varname>$another_cart</varname>, both of the class Cart. The function - add_item() of the <varname>$cart</varname> object is being called to add 1 + <literal>add_idem()</literal> of the <varname>$cart</varname> object is being called to add 1 item of article number 10 to the <varname>$cart</varname>. 3 items of article number 0815 are being added to <varname>$another_cart</varname>. </para> <para> Both, <varname>$cart</varname> and <varname>$another_cart</varname>, have - functions add_item(), remove_item() and a variable items. These are - distinct functions and variables. You can think of the objects as - something similar to directories in a filesystem. In a filesystem you can - have two different files <filename>README.TXT</filename>, as long as they - are in different directories. Just like with directories where you'll have - to type the full pathname in order to reach each file from the toplevel - directory, you have to specify the complete name of the function you want to - call: in PHP terms, the toplevel directory would be the global namespace, - and the pathname separator would be <literal>-&gt;</literal>. Thus, the + functions <literal>add_item()</literal>, <literal>remove_item()</literal> + and a variable <varname>items</varname>. These are distinct functions and variables. You can + think of the objects as something similar to directories in a filesystem. + In a filesystem you can have two different files + <filename>README.TXT</filename>, as long as they are in different directories. + Just like with directories where you'll have to type the full pathname in + order to reach each file from the toplevel directory, you have to specify + the complete name of the function you want to call: in PHP terms, the + toplevel directory would be the global namespace, and the pathname separator + would be <literal>-&gt;</literal>. Thus, the names <varname>$cart-&gt;items</varname> and <varname>$another_cart-&gt;items</varname> name two different variables. Note that the variable is named <varname>$cart-&gt;items</varname>, not <varname>$cart-&gt;$items</varname>, that is, a variable name in PHP has - only a single dollar sign. + only a single dollar sign (<literal>$</literal>). </para> <informalexample> @@ -328,7 +329,7 @@ subtract from a class, that is, to undefine any existing functions or variables. An extended class is always dependent on a single base class, that is, multiple inheritance is - not supported. Classes are extended using the keyword 'extends'. + not supported. Classes are extended using the keyword '<literal>extends</literal>'. </para> <informalexample> @@ -350,7 +351,7 @@ <para> This defines a class Named_Cart that has all variables and functions of Cart plus an additional variable <varname>$owner</varname> and an - additional function set_owner(). You create a named cart the usual way and + additional function <literal>set_owner()</literal>. You create a named cart the usual way and can now set and get the carts owner. You can still use normal cart functions on named carts: </para> @@ -418,8 +419,8 @@ <para> This defines a class Auto_Cart that is a Cart plus a constructor which initializes the cart with one item of article number "10" - each time a new Auto_Cart is being made with "new". Constructors - can take arguments and these arguments can be optional, which + each time a new Auto_Cart is being made with "<literal>new</literal>". + Constructors can take arguments and these arguments can be optional, which makes them much more useful. To be able to still use the class without parameters, all parameters to constructors should be made optional by providing default values. @@ -517,8 +518,8 @@ <para> Sometimes it is useful to refer to functions and variables in base classes or to refer to functions in classes that - have not yet any instances. The :: operator is being used - for this. + have not yet any instances. The <literal>::</literal> operator + is being used for this. </para> <informalexample> @@ -556,10 +557,10 @@ </informalexample> <para> - The above example calls the function example() in + The above example calls the function <literal>example()</literal> in class A, but there is no object of class A, so that - we cannot write $a->example() or similar. Instead we - call example() as a 'class function', that is, as a + we cannot write <literal>$a->example()</literal> or similar. Instead we + call <literal>example()</literal> as a 'class function', that is, as a function of the class itself, not any object of that class. </para> @@ -573,12 +574,12 @@ </para> <para> - In the above example, class B redefines the function example(). - The original definition in class A is shadowed + In the above example, class B redefines the function + <literal>example()</literal>. The original definition in class A is shadowed and no longer available, unless you are referring specifically - to the implementation of example() in class A using the - ::-operator. Write A::example() to do this (in fact, you - should be writing parent::example(), as shown in the next + to the implementation of <literal>example()</literal> in class A using the + ::-operator. Write <literal>A::example()</literal> to do this (in fact, you + should be writing <literal>parent::example()</literal>, as shown in the next section). </para> @@ -655,13 +656,14 @@ <para> In order to be able to <function>unserialize</function> an object, the class of that object needs to be defined. That is, if you have an object - <varname>$a</varname> of class A on page1.php and serialize this, you'll + <varname>$a</varname> of class A on <filename>page1.php</filename> and serialize this, you'll get a string that refers to class A and contains all values of variabled contained in <varname>$a</varname>. If you want to be able to unserialize - this on page2.php, recreating <varname>$a</varname> of class A, the - definition of class A must be present in page2.php. This can be done for - example by storing the class definition of class A in an include file and - including this file in both page1.php and page2.php. + this on <filename>page2.php</filename>, recreating <varname>$a</varname> of class A, the + definition of class A must be present in <filename>page2.php</filename>. + This can be done for example by storing the class definition of class A + in an include file and including this file in both + <filename>page1.php</filename> and <filename>page2.php</filename>. </para> <informalexample> @@ -727,8 +729,8 @@ <para> So if in the example above <varname>$a</varname> became part of a session by running <literal>session_register("a")</literal>, you should include the - file <literal>classa.inc</literal> on all of your pages, not only page1.php - and page2.php. + file <literal>classa.inc</literal> on all of your pages, not only <filename>page1.php</filename> + and <filename>page2.php</filename>. </para> </sect1> @@ -839,7 +841,7 @@ Apparently there is no difference, but in fact there is a very significant one: <varname>$bar1</varname> and <varname>$globalref[0]</varname> are _NOT_ referenced, they - are NOT the same variable. This is because "new" does not + are NOT the same variable. This is because "<literal>new</literal>" does not return a reference by default, instead it returns a copy. <note> <simpara>
« previous php.doc.cvs (#3939) next »