cvs: phpdoc-ar /language control-structures.xml

From: Date: Thu, 01 Jan 2004 20:28:12 +0000
Subject: cvs: phpdoc-ar /language control-structures.xml
Groups: php.doc.ar 
Request: Send a blank email to doc-ar+get-593@lists.php.net to get a copy of this message
hafid Thu Jan 1 15:28:12 2004 EDT Modified files: /phpdoc-ar/language control-structures.xml Log: Final Partial Translation.

Index: phpdoc-ar/language/control-structures.xml diff -u phpdoc-ar/language/control-structures.xml:1.1 phpdoc-ar/language/control-structures.xml:1.2 --- phpdoc-ar/language/control-structures.xml:1.1 Fri Dec 26 19:08:32 2003 +++ phpdoc-ar/language/control-structures.xml Thu Jan 1 15:28:12 2004 @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ISO-8859-6"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.83 Maintainer: hafid Status: working --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.83 Maintainer: hafid Status: ready --> <chapter id="control-structures"> - <title>Control Structures</title> + <title>Èïæé ÇäÊñîÍãñïå</title> <simpara> êÊÃäá Ãê ÎÇ×è× PHP åæ åÌåèÙÉ åæ ÇäÈäÇÚÇÊ. ÇäÈäÇÚ êåãæ Ãæ êãèæ ÊÙêêæÇë¬ æÏÇÁ ÏÇäɬ Íäâɬ ÈäÇÚÇ ÔÑ×êñÇ Ãè ÍÊé ÈäÇÚÇ äÇ êâèå ÈÃêñ ÔêÁ (ÈäÇÚ - áÇÑÚ). ÚÇÏÉ åÇ ÊæÊçê ÇäÈäÇÚÇÊ ÈáÇÕäÉ åæâè×É. ãÐä㬠- áÅæñîç êåãæ ÊÌåêÙ ÇäÈäÇÚÇÊ Öåæ åÌåèÙÉ ÈäÇÚêñîÉ åæ ÎäÇä ÊÚäêá + áÇÑÚ). ÙÇÏÉ åÇ ÊæÊçê ÇäÈäÇÚÇÊ ÈáÇÕäÉ åæâè×É. ãÐä㬠+ áÅæñîç êåãæ ÊÌåêÙ ÇäÈäÇÚÇÊ Öåæ åÌåèÙÉ ÈäÇÚêñîÉ èÇÍÏÉ åæ ÎäÇä ÊÚäêá åÌåèÙÉ ÈäÇÚÇÊ ÈÍÇÖæÊêæ åÙâèáÊêæ ("<literal>{}</literal>"). åÌåèÙÉ ÈäÇÚêñîÉ ÊïÙÊÈÑ áê ÍÏ ÐÇÊçÇ ÈäÇÚÇë ÃêÖÇ. Åæñî åÎÊäá ÃæèÇÙ ÇäÈäÇÚÇÊ çê åÍä èÕá áê çÐÇ ÇäáÕä. @@ -476,14 +476,14 @@ </informalexample> </para> <para> - Other languages have a <literal>foreach</literal> statement to - traverse an array or hash. PHP 3 has no such construct; PHP 4 does - (see <link - linkend="control-structures.foreach">foreach</link>). In PHP 3, you - can combine <link linkend="control-structures.while">while</link> - with the <function>list</function> and <function>each</function> - functions to achieve the same effect. See the documentation for - these functions for an example. + ÊÊèáÑ ÈÙÖ ÇääñïÚÇÊ ÇäÃÎÑé Ùäé ÈäÇÚ <literal>foreach</literal> + äÙÈèÑ åÕáèáÉ Ãè ÊÌÒÆÉ. äÇ ÊÊèáÑ PHP 3 Ùäé åËä çÐÇ ÇäÈæÇÁ áê Íêæ êÊèáÑ Ùäêç PHP 4 + (ÇÓÊÙÑÖ <link + linkend="control-structures.foreach">foreach</link>). áê PHP 3¬ + êåãæã ÅÔÑÇã <link linkend="control-structures.while">while</link> + ÈÏèÇä <function>list</function> è <function>each</function> + ÈÚÑÖ ÅæÌÇÒ æáÓ ÇäÊñîÇËêÑ. ÇÓÊÙÑÖ ÇäÊñîèËêâ ÇäÎÇÕ + ÈçÐç ÇäÏñîèÇä äÃÌä ÇäÍÕèä Ùäé åËÇä. </para> </sect1> @@ -491,70 +491,70 @@ <sect1 id="control-structures.foreach"> <title><literal>foreach</literal></title> <para> - PHP 4 (not PHP 3) includes a <literal>foreach</literal> construct, much - like Perl and some other languages. This simply gives an easy way to - iterate over arrays. <literal>foreach</literal> works only on arrays, and - will issue an error when you try to use it on a variable with a different - data type or an uninitialized variable. There are two syntaxes; the - second is a minor but useful extension of the first: + ÊÊÖåæ PHP 4 (äêÓ PHP 3) ÈæÇÁ <literal>foreach</literal>¬ åËäåÇ + ÇäÍÇä åÙ Perl èÈÖÙ äÚÇÊ ÃÎÑé. êïÙò×ê çÐÇ ×ÑêâÉ ÓçäÉ + äÅÊåÇå ÊãÑÇÑÇÊ Ùäé ÇäåÕáèáÇÊ. ÊÙåä <literal>foreach</literal> áâ× Ùäé ÇäåÕáèáÇÊ èçê + ÊÓÊÕÏÑ Î×Ãë ÍêæåÇ ÊÍÇèä ÇÓÊÎÏÇåçÇ Ùäé åïÊÚêñðÑ Ðê æèÙ ÈêÇæêñ + åÚÇêÑ Ãè åïÊÚêñðÑ ÚêÑ åïÓÊçñîä. çæÇã ÕêÚÊêæ æÍèêÊêæ» + ÊïÙòÊîÈîÑï ÇäËñîÇæêÉ ÊèÓÙÇë ×áêáÇë äãæ åáêÏÇë ääÃèäé: <informalexample> <programlisting> <![CDATA[ -foreach (array_expression as $value) statement -foreach (array_expression as $key => $value) statement +foreach (array_expression as $value) ÈäÇÚ +foreach (array_expression as $key => $value) ÈäÇÚ ]]> </programlisting> </informalexample> </para> <simpara> - The first form loops over the array given by - <literal>array_expression</literal>. On each loop, the value of - the current element is assigned to <literal>$value</literal> and - the internal array pointer is advanced by one (so on the next - loop, you'll be looking at the next element). + êïÊåðåï ÇäÔñîãäï ÇäÃèä ÍäâÇÊ Ùäé ÇäåÕáèáÉ ÇäåïÙò×îÇÉ åæ âðÈîä + <literal>array_expression</literal>. ÙæÏ ãäñ Íäâɬ ÊïÙêñîæ âêåÉ + ÇäÙæÕÑ ÇäÑñîÇçæ ÈÇÊÌÇç <literal>$value</literal> + èêÊå ÊâÏêå åÄÔÑ ÇäåÕáèáÉ ÇäÏñîÇÎäêñ ÈèÇÍÏ (ÈÍêË Ãæñîç ÙæÏ + ÇäÍäâÉ ÇäÂÊêñîɬ ÓÊãèæ ÈÕÏÏ ÇäæñîØÑ Åäé ÇäÙæÕÑ ÇäåèÇäêñ). </simpara> <simpara> - The second form does the same thing, except that the current - element's key will be assigned to the variable - <literal>$key</literal> on each loop. + êâèå ÇäÔñîãä ÇäËñîÇæêñ ÈæáÓ ÇäÔñîêÁ áêåÇ ÙÏÇ Ãæñî + åáÊÇÍ ÇäÙæÕÑ ÇäÑñîÇçæ êïÙêñîæ ÈÇÊÌÇç ÇäåïÊÚêñðÑ + <literal>$key</literal>¬ ÙæÏ ãäñ ÍäâÉ. </simpara> <para> <note> <para> - When <literal>foreach</literal> first starts executing, the - internal array pointer is automatically reset to the first element - of the array. This means that you do not need to call - <function>reset</function> before a <literal>foreach</literal> - loop. + ÙæÏ Ãè ÈÏÇêÉ äà <literal>foreach</literal> áê ÇäÊñîæáêЬ + ÊÊå ÅÙÇÏÉ ÊÙêêæ åÄÔÑ ÇäåÕáèáÉ ÇäÏñîÇÎäê ÈÔãä Âäêñ ÈÍÓÈ ÙæÕÑ + ÇäåÕáèáÉ ÇäÃèä. êÙæê çÐÇ Ãæñîã äÓÊ ÈÍÇÌÉ äåæÇÏÇÉ + <function>reset</function> âÈä ÍäâÉ <literal>foreach</literal> + . </para> </note> </para> <para> <note> <para> - Also note that <literal>foreach</literal> operates on a copy of - the specified array and not the array itself. Therefore, the - array pointer is not modified as with the - <function>each</function> construct, and changes to the array - element returned are not reflected in the original array. - However, the internal pointer of the original array - <emphasis>is</emphasis> advanced with the processing of the - array. Assuming the foreach loop runs to completion, the - array's internal pointer will be at the end of the array. + ãÐä㬠äÇÍØ Ãæ <literal>foreach</literal> êÙåä Ùäé æÓÎÉ åæ + ÇäåÕáèáÉ ÇäåïÍÏñîÏîÉ èäêÓ ÇäåÕáèáÉ æáÓçÇ. äÐä㬠áÅæñîç + äÇ êÊå ÊÙÏêä åÄÔÑ ÇäåÕáèáÉ åËäåÇ êÊå åÙ + ÈæÇÁ <function>each</function> èÇäÊñîÚêêÑÇÊ Çä×ñîÇÑÆÉ Ùäé ÙæÕÑ ÇäåÕáèáÉ + äÇ êÊå¬ ÙæÏ ÅÙÇÏÊçǬ ÃÎÐçÇ ÈÙêæ ÇäÇÙÊÈÇÑ áê ÇäåÕáèáÉ ÇäÃÕäêñîÉ. + åÙ Ðä㬠áÅæñî ÇäåÄÔÑ ÇäÏñîÇÎäêñ ääåÕáèáÉ ÇäÃÕäêñîÉ + <emphasis>êÊå</emphasis> ÊâÏêåç ÈÑáâÉ åÙÇäÌÉ + ÇäåÕáèáÉ. åÙ ÇáÊÑÇÖ Ãæ ÍäâÉ foreach ÊÔÊÚä äÚÇêÉ ÇäÇãÊåÇä¬ áÅæñî + ÇäåÄÔÑ ÇäÏñîÇÎäêñ ÇäÎÇÕ ÈÇäåÕáèáÉ Óêãèæ ÙæÏ æçÇêÉ ÇäåÕáèáÉ. </para> </note> </para> <para> <note> <para> - <literal>foreach</literal> does not support the ability to - suppress error messages using '@'. + äÇ ÊÏÙå <literal>foreach</literal> âÇÈäêÉ + ÅÒÇäÉ ÑÓÇÆä ÇäÃÎ×ÇÁ ÈÇÓÊÎÏÇå '@'. </para> </note> </para> <para> - You may have noticed that the following are functionally - identical: + êåãæ Ãæñîã äÇÍØÊ Ãæñî åÇ êäê¬ çè åæ ÇäæñîÇÍêÉ ÇäèØêáêñîɬ + åÊåÇËä: <informalexample> <programlisting role="php"> <![CDATA[ @@ -572,7 +572,7 @@ ]]> </programlisting> </informalexample> - The following are also functionally identical: + åÇ êäê çè ÃêÖǬ åæ ÇäæñîÇÍêÉ ÇäèØêáêñîɬ åÊåÇËä: <informalexample> <programlisting role="php"> <![CDATA[ @@ -591,31 +591,31 @@ </informalexample> </para> <para> - Some more examples to demonstrate usages: + ÈÙÖ ÇäÃåËäÉ ÇäÃÎÑé äÊÈêÇæ ÇäÅÓÊÎÏÇåÇÊ: <informalexample> <programlisting role="php"> <![CDATA[ <?php -/* foreach example 1: value only */ +/* åËÇä Ñâå 1 Ùæ foreach: ÇäâêåÉ áâ× */ $a = array (1, 2, 3, 17); foreach ($a as $v) { - print "Current value of \$a: $v.\n"; + print "ÇäâêåÉ ÇäÍÇäêñîÉ äà \$a: $v.\n"; } -/* foreach example 2: value (with key printed for illustration) */ +/* åËÇä Ñâå 2 Ùæ foreach: âêåÉ (åïÑòáîâ ÈåáÊÇÍ å×ÈèÙ äÃÌä ÇäÅêÖÇÍ) */ $a = array (1, 2, 3, 17); -$i = 0; /* for illustrative purposes only */ +$i = 0; /* äÃÚÑÇÖ ÊèÖêÍêñîÉ áâ× */ foreach ($a as $v) { print "\$a[$i] => $v.\n"; $i++; } -/* foreach example 3: key and value */ +/* åËÇä Ñâå 3 Ùæ foreach: åáÊÇÍ èâêåÉ */ $a = array ( "one" => 1, @@ -628,7 +628,7 @@ print "\$a[$k] => $v.\n"; } -/* foreach example 4: multi-dimensional arrays */ +/* åËÇä Ñâå 4 Ùæ foreach: åÕáèáÇÊ åïÊÙÏñðÏîÉ ÇäÃÈÙÇÏ */ $a[0][0] = "a"; $a[0][1] = "b"; @@ -641,7 +641,7 @@ } } -/* foreach example 5: dynamic arrays */ +/* åËÇä Ñâå 5 Ùæ foreach: åÕáèáÇÊ ÍêèêñîÉ */ foreach (array(1, 2, 3, 4, 5) as $v) { print "$v\n"; @@ -656,15 +656,15 @@ <sect1 id="control-structures.break"> <title><literal>break</literal></title> <simpara> - <literal>break</literal> ends execution of the current - <literal>for</literal>, <literal>foreach</literal> - <literal>while</literal>, <literal>do..while</literal> or - <literal>switch</literal> structure. + Êïæçðê <literal>break</literal> ÊæáêÐ ÈæêÉ + <literal>for</literal>¬ <literal>foreach</literal>¬ + <literal>while</literal>¬ <literal>do..while</literal> Ãè + <literal>switch</literal> ÇäÍÇäêñîÉ. </simpara> <simpara> - <literal>break</literal> accepts an optional numeric argument - which tells it how many nested enclosing structures are to be - broken out of. + ÊâÈä <literal>break</literal> ÏäêäÇë ÑâåêñÇ ÇÎÊêÇÑêñÇ + êïÎÈðÑïçÇ Ùæ ÙÏÏ ÇäÈïæé ÇäåïÍðê×îÉ ÇäåïÊîÔîÇÈðãîÉ + ÇäÂêäÉ ääÇÙÇâÉ. </simpara> <para> <informalexample> @@ -674,22 +674,22 @@ $arr = array ('one', 'two', 'three', 'four', 'stop', 'five'); while (list (, $val) = each ($arr)) { if ($val == 'stop') { - break; /* You could also write 'break 1;' here. */ + break; /* êåæãã ÃêÖÇ ãÊÇÈÉ 'break 1;' çæÇ. */ } echo "$val<br>\n"; } -/* Using the optional argument. */ +/* ÇÓÊÎÏÇå ÇäÏñîäêä ÇäÇÎÊêÇÑêñ. */ $i = 0; while (++$i) { switch ($i) { case 5: echo "At 5<br>\n"; - break 1; /* Exit only the switch. */ + break 1; /* ÇäÎÑèÌ áâ× åæ switch. */ case 10: - echo "At 10; quitting<br>\n"; - break 2; /* Exit the switch and the while. */ + echo "ÙæÏ 10; ÇäåïÚÇÏîÑîÉ<br>\n"; + break 2; /* ÇäÎÑèÌ åæ switch è while. */ default: break; } @@ -704,22 +704,22 @@ <sect1 id="control-structures.continue"> <title><literal>continue</literal></title> <simpara> - <literal>continue</literal> is used within looping structures to - skip the rest of the current loop iteration and continue execution - at the beginning of the next iteration. + ÊïÓÊÎÏîå <literal>continue</literal> ÏÇÎä ÇäÈæé ÇäÍäâêñîÉ ÈÚÑÖ + ÊÎ×ê ÈâêÉ ÊãÑÇÑ ÇäÍäâÉ ÇäÍÇäêñîÉ èåèÇÕäÉ ÇäÊñîæáêÐ + ÙæÏ ÈÏÇêÉ ÇäÊñðãÑÇÑ ÇäåïâÈðä. </simpara> <note> <simpara> - Note that in PHP the - <link linkend="control-structures.switch">switch</link> statement is - considered a looping structure for the purposes of + äÇÍØ Ãæñîç áê PHP¬ + êïÙÊîÈîÑ ÈäÇÚï <link linkend="control-structures.switch">switch</link> + ÈåËÇÈÉ ÈæêÉ ÍäâêñîÉ äÃÚÑÇÖ <literal>continue</literal>. </simpara> </note> <simpara> - <literal>continue</literal> accepts an optional numeric argument - which tells it how many levels of enclosing loops it should skip - to the end of. + ÊâÈä <literal>continue</literal> ÏäêäÇ ÑâåêñÇ ÇÎÊêÇÑêñÇ + êïÎÈðÑïçÇ Ùæ ÙÏÏ ÇäåÓÊèêÇÊ ÇäÎÇÕÉ ÈÇäÍäâÇÊ ÇäåïÍðê×É ÇäåÊèÌÈ ÙäêçÇ ÊÎ×êçÇ + Åäé æçÇêÊçÇ. </simpara> <para> <informalexample> @@ -727,7 +727,7 @@ <![CDATA[ <?php while (list ($key, $value) = each ($arr)) { - if (!($key % 2)) { // skip odd members + if (!($key % 2)) { // ÊÎ×ê ÇäÃÙÖÇÁ ÇäáïÑÇÏîé continue; } do_something_odd ($value); @@ -737,14 +737,14 @@ while ($i++ < 5) { echo "Outer<br>\n"; while (1) { - echo "&nbsp;&nbsp;Middle<br>\n"; + echo "&nbsp;&nbsp;èÓ×<br>\n"; while (1) { - echo "&nbsp;&nbsp;Inner<br>\n"; + echo "&nbsp;&nbsp;ÏÇÎä<br>\n"; continue 3; } - echo "This never gets output.<br>\n"; + echo "äÇ êÍÕä çÐÇ ÃÈÏÇ Ùäé åïÎòÑîÌ.<br>\n"; } - echo "Neither does this.<br>\n"; + echo "èäÇ çÐÇ.<br>\n"; } ?> ]]> @@ -752,8 +752,8 @@ </informalexample> </para> <para> - Omitting the semicolon after <literal>continue</literal> can lead to - confusion. Here's an example of what you shouldn't do. + êåãæ äÇÚáÇä Çäæñïâ×É ÇäáÇÕðäîÉ ÈÙÏ <literal>continue</literal> Ãæ êÄÏê + ääÇäÊÈÇÓ. ÌðÏ çæÇ åËÇäÇ ÙåÇ êÌÈ Ãæ äÇ Êâèå Èç. </para> <para> <informalexample> @@ -769,7 +769,7 @@ ]]> </programlisting> <para> - One can expect the result to be : + êåãæ ääåÑÁ Ãæ êÊèâÙ Ãæ Êãèæ ÇäæñîÊêÌÉ çê: </para> <screen> <![CDATA[ @@ -780,7 +780,7 @@ ]]> </screen> <para> - but this script will output : + äãæ çÐÇ ÇäÎÇ×è× ÓêÓÊÕÏÑ: </para> <screen> <![CDATA[ @@ -788,9 +788,9 @@ ]]> </screen> <para> - because the return value of the <function>print</function> - call is <literal>int(1)</literal>, and it will look like the - optional numeric argument mentioned above. + äÃæñî âêåÉ ÇäÇÑÌÇÙ ÇäÎÇÕÉ ÈåæÇÏÇÉ <function>print</function> + çê <literal>int(1)</literal> èÓîÊîØòçîÑ åËä + ÇäÏñîäêä ÇäÑñîâåêñ ÇäÇÎÊêÇÑêñ ÇäåïÔÇÑ Åäêç áê ÇäÃÙäé. </para> </informalexample> </para> @@ -799,48 +799,48 @@ <sect1 id="control-structures.switch"> <title><literal>switch</literal></title> <simpara> - The <literal>switch</literal> statement is similar to a series of - IF statements on the same expression. In many occasions, you may - want to compare the same variable (or expression) with many - different values, and execute a different piece of code depending - on which value it equals to. This is exactly what the - <literal>switch</literal> statement is for. + êïÔÈðçï ÈäÇÚ <literal>switch</literal> åÌåèÙÉ + ÈäÇÚÇÊ IF áê æáÓ ÇäÙÈÇÑÉ. áê ÙÏÉ åæÇÓÈÇʬ êåãæ + Ãæ ÊÑÚÈ áê åâÇÑæÉ æáÓ ÇäåïÊÚêñðÑ (Ãè ÇäÙÈÇÑÉ) åÙ ÙÏÉ + âêå åÎÊäáÉ èÊæáêÐ åâ×Ù ÔêáÑÉ ÈÍÓÈ + ÇäâêåÉ ÇäÊñðê êÓÇèêçÇ. çÐÇ çè ÈÇäÖñîÈ× ÚÑÖ + ÈäÇÚ <literal>switch</literal>. </simpara> <note> <simpara> - Note that unlike some other languages, the - <link linkend="control-structures.continue">continue</link> statement - applies to switch and acts similar to <literal>break</literal>. If you - have a switch inside a loop and wish to continue to the next iteration of - the outer loop, use <literal>continue 2</literal>. + äÇÍØ Ãæñîç ÈÙãÓ ÈÙÖ ÇääñïÚÇÊ ÇäÃÎÑé¬ áÅæñî + ÈäÇÚ <link linkend="control-structures.continue">continue</link> + êæ×äÈâ Ùäé switch èêÊÕÑá åËä <literal>break</literal>. ÅÐÇ ãÇæ + äÏêã switch ÏÇÎä ÍäâÉ èãæÊ ÊÑÚÈ áê ÇäÇÓÊåÑÇÑ äÚÇêÉ ÇäÊñðãÑÇÑ ÇäåïâÈðä + ÇäÎÇÕ ÈÇäÍäâÉ ÇäÎÇÑÌêñîɬ áÇÓÊÎÏå <literal>continue 2</literal>. </simpara> </note> <para> - The following two examples are two different ways to write the - same thing, one using a series of <literal>if</literal> - statements, and the other using the <literal>switch</literal> - statement: + êïÙÊÈÑ ÇäåËÇäêæ ÇäÊñîÇäêñêæ ×ÑêâÊêæ åÎÊäáÊêæ äãÊÇÈÉ + æáÓ ÇäÔñîêÁ¬ êÓÊÎÏå ÃÍÏçåÇ åÌåèÙÉ åæ ÈäÇÚÇÊ <literal>if</literal> + áê Íêæ êÓÊÎÏå ÇäÂÎÑ ÈäÇÚ <literal>switch</literal> + : <informalexample> <programlisting role="php"> <![CDATA[ <?php if ($i == 0) { - print "i equals 0"; + print "i êÓÇèê 0"; } elseif ($i == 1) { - print "i equals 1"; + print "i êÓÇèê 1"; } elseif ($i == 2) { - print "i equals 2"; + print "i êÓÇèê 2"; } switch ($i) { case 0: - print "i equals 0"; + print "i êÓÇèê 0"; break; case 1: - print "i equals 1"; + print "i êÓÇèê 1"; break; case 2: - print "i equals 2"; + print "i êÓÇèê 2"; break; } ?> @@ -849,30 +849,30 @@ </informalexample> </para> <para> - It is important to understand how the <literal>switch</literal> - statement is executed in order to avoid mistakes. The - <literal>switch</literal> statement executes line by line - (actually, statement by statement). In the beginning, no code is - executed. Only when a <literal>case</literal> statement is found - with a value that matches the value of the - <literal>switch</literal> expression does PHP begin to execute the - statements. PHP continues to execute the statements until the end - of the <literal>switch</literal> block, or the first time it sees - a <literal>break</literal> statement. If you don't write a - <literal>break</literal> statement at the end of a case's - statement list, PHP will go on executing the statements of the - following case. For example: + Åæñîç äåæ ÇäÃçåêÉ áçå Çä×ÑêâÉ ÇäÊñðê êïæáñîÐï ÈçÇ ÈäÇÚ <literal>switch</literal> + ÈÚÑÖ ÊÌæÈ ÇäÃÎ×ÇÁ. êïæáñîÐï + ÈäÇÚ <literal>switch</literal> Ó×ÑÇ ÈÓ×Ñ + (ÍÇäêÇë¬ ÈäÇÚ ÈÈäÇÚ). áê ÇäÈÏÇêɬ äÇ ÊïæáñîÐï ÃêñîÉ + ÔêáÑÉ. áâ× ÙæÏåÇ êÊå ÅêÌÇÏ ÈäÇÚ <literal>case</literal> + åÑáèâÇë ÈâêåÉ ÊÊ×ÇÈâ åÙ âêåÉ + ÇäÙÈÇÑÉ <literal>switch</literal>¬ ÊÈÏà PHP áê ÊæáêÐ + ÇäÈäÇÚÇÊ. ÊÓÊåÑ PHP áê ÊæáêÐ ÇäÈäÇÚÇÊ äÚÇêÉ ÇæÊçÇÁ + ãÊäÉ <literal>switch</literal> Ãè ÈåÌÑÏ Ãæ ÊâÙ ääèçäÉ ÇäÃèäé + Ùäé ÈäÇÚ <literal>break</literal>. ÅÐÇ äå ÊãÊÈ + ÈäÇÚ <literal>break</literal> ÙæÏ æçÇêÉ äÇÆÍÉ ÈäÇÚÇÊ case¬ + áÅæñî PHP ÓÊèÇÕä ÊæáêÐ ÇäÈäÇÚÇÊ ÇäÎÇÕÉ Èà + case ÇääÇÍâÉ. Ùäé ÓÈêä ÇäåËÇä: <informalexample> <programlisting role="php"> <![CDATA[ <?php switch ($i) { case 0: - print "i equals 0"; + print "i êïÓÇèê 0"; case 1: - print "i equals 1"; + print "i êïÓÇèê 1"; case 2: - print "i equals 2"; + print "i êïÓÇèê 2"; } ?> ]]> @@ -880,25 +880,25 @@ </informalexample> </para> <simpara> - Here, if $i is equal to 0, PHP would execute all of the print - statements! If $i is equal to 1, PHP would execute the last two - print statements. You would get the expected behavior ('i equals 2' - would be displayed) only if $i is equal to 2. Thus, - it is important not to forget <literal>break</literal> statements - (even though you may want to avoid supplying them on purpose under - certain circumstances). + çæÇ: ÅÐÇ ãÇæÊ $i åÓÇèêñîÉ äà 0¬ áÅæñî PHP ÓÊñïæáñðÐ åïÌåîäî ÈäÇÚÇÊ print ! + ÅÐÇ ãÇæÊ $i åïÓÇèêñîÉ äà 1¬ áÅæñî PHP ÓÊïæáñðÐï ÂÎÑ ÈäÇÚêæ åæ + print. ÓÊÍÕïä Ùäé ÇäÓñïäèã ÇäåïÊèâÙ ('i êïÓÇèê 2' + Êãèæ åÍä ÇäÙÑÖ) áâ× ÅÐÇ ãÇæÊ $i åïÓÇèêñîÉ äà 2. çãÐÇ ÅÐæ¬ + êãèæ åæ ÇäÃçåêÉ ÙÏå æÓêÇæ ÈäÇÚÇÊ <literal>break</literal> + (ÍÊé èÅæ èÏðÏÊ ÊÌæÈ ÊèáêÑçǬ âÕÏÇë¬ + áê ØÑèá åïÙêñîæÉ). </simpara> <simpara> - In a <literal>switch</literal> statement, the condition is - evaluated only once and the result is compared to each - <literal>case</literal> statement. In an <literal>elseif</literal> - statement, the condition is evaluated again. If your condition is - more complicated than a simple compare and/or is in a tight loop, - a <literal>switch</literal> may be faster. + áê ÈäÇÚ <literal>switch</literal>¬ êïâêñîåï ÇäÔñîÑ×ï + áâ× äåÑÉ èÇÍÏÉ èÊïâÇÑîæï ÇäæñîÊêÌÉï åÙ ãäñ ÈäÇÚí åæ + <literal>case</literal>. áê ÈäÇÚ <literal>elseif</literal>¬ + êïâêñîåï ÇäÔñîÑ×ï åæ ÌÏêÏ. ÅÐÇ ãÇæ ÔÑ×ã + ÃÙâÏ åæ åâÇÑæÉ ÈÓê×É è/Ãè ÅÐÇ ãÇæ áê ÍäâÉ åÔÏèÏɬ + áÅæñî <literal>switch</literal> êåãæ Ãæ Êãèæ ÃÓÑÙ. </simpara> <para> - The statement list for a case can also be empty, which simply - passes control into the statement list for the next case. + êåãæ ääÇÆÍÉ ÇäÈäÇÚÇÊ ÇäÎÇÕÉ Èà case Ãæ Êãèæ áÇÑÚÉ ååÇ êïåÑñðÑï + ÈÈÓÇ×É ÇäÊñîÍãñïå ÏÇÎä äÇÆÍÉ ÇäÈäÇÚÇÊ Åäé case ÇääÇÍâÉ. <informalexample> <programlisting role="php"> <![CDATA[ @@ -907,10 +907,10 @@ case 0: case 1: case 2: - print "i is less than 3 but not negative"; + print "i ÃÕÚÑ åæ 3 äãæñîç äêÓ ÓÇäÈÇë"; break; case 3: - print "i is 3"; + print "i çè 3"; } ?> ]]> @@ -918,25 +918,25 @@ </informalexample> </para> <para> - 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: + "case" ÇäÎÇÕ (special case) çè "case" <literal>ÇäÇáÊÑÇÖêñ</literal>. êÊ×ÇÈâ çÐÇ Çäà "case" + åÙ Ãêñ ÔêÁ äå êãæ åÍä Ê×ÇÈâ åæ ×Ñá Çäà "cases" ÇäÃÎÑé èêÌÈ Ãæ ÂÎÑ + ÈäÇÚ <literal>case</literal>. Ùäé ÓÈêä ÇäåËÇä: <informalexample> <programlisting role="php"> <![CDATA[ <?php switch ($i) { case 0: - print "i equals 0"; + print "i êïÓÇèê 0"; break; case 1: - print "i equals 1"; + print "i êïÓÇèê 1"; break; case 2: - print "i equals 2"; + print "i êïÓÇèê 2"; break; default: - print "i is not equal to 0, 1 or 2"; + print "i äÇ êïÓÇèê 0¬ 1 Ãè 2"; } ?> ]]> @@ -944,32 +944,32 @@ </informalexample> </para> <para> - The <literal>case</literal> expression may be any expression that - evaluates to a simple type, that is, integer or floating-point - numbers and strings. Arrays or objects cannot be used here unless - they are dereferenced to a simple type. + êåãæ äÙÈÇÑÉ <literal>case</literal> Ãæ Êãèæ ÃêÉ ÙÈÇÑÉ Êïâêñîå + ÈÍÓÈ æèÙ ÈÓê׬ ÓèÇÁ à ãÇæ ÙÏÏÇ ÕÍêÍÇ Ãè ÃÙÏÇÏÇ Ðê æâÇ× ÙÇÆåÉ + èÓäÇÓä æÕêñîÉ. äÇ êåãæ ÇÓÊÎÏÇå ÇäåÕáèáÇÊ Ãè ÇäãÇÆæÇÊ çæÇ ÅäÇ ÅÐÇ + ÃÒêäÊ ÅÍÇäÊçÇ äÊÕÈÍ ÐÇÊ æèÙ ÈÓê×. </para> <para> - The alternative syntax for control structures is supported with - switches. For more information, see <link - linkend="control-structures.alternative-syntax">Alternative syntax - for control structures</link> . + ÊÊÓå ÇäÕñðêÚÉ ÇäæñîÍèêñîÉ ÇäÈÏðêäÉ ÇäÎÇÕÉ ÈÇäÈïæé ÇäÊñîÍãñïåêñîÉ ÈãèæçÇ åÏÙèåÉë åÙ + Çäàswitches. äåÒêÏ åæ ÇäåÙäèåÇʬ ÇÓÊÙÑÖ <link + linkend="control-structures.alternative-syntax">ÇäÕñðêÚÉ ÇäæñîÍèêñîÉ ÇäÈÏðêäÉ + ÇäÎÇÕÉ ÈÇäÈïæé ÇäÊñîÍãñïåêñîÉ</link> . <informalexample> <programlisting role="php"> <![CDATA[ <?php switch ($i): case 0: - print "i equals 0"; + print "i êïÓÇèê 0"; break; case 1: - print "i equals 1"; + print "i êïÓÇèê 1"; break; case 2: - print "i equals 2"; + print "i êïÓÇèê 2"; break; default: - print "i is not equal to 0, 1 or 2"; + print "i äêÓ åÓÇèêñÇ äà 0¬ 1 Ãè 2"; endswitch; ?> ]]> @@ -981,52 +981,52 @@ <sect1 id="control-structures.declare"> <title><literal>declare</literal></title> <para> - The <literal>declare</literal> construct is used to - set execution directives for a block of code. - The syntax of <literal>declare</literal> is similar to - the syntax of other flow control constructs: + êïÓÊÎÏå ÈæÇÁ <literal>declare</literal> ÈÚÑÖ + ÅÙÏÇÏ ÊèÌêçÇÊ ÇäÊñîæáêÐ ÇäÎÇÕÉ ÈãÊäÉ åæ ÇäÔñðêáÑÉ. + ÊïÔòÈðçï ÇäÕñðêÚÉ ÇäæñîÍèêñîÉ ÇäÎÇÕÉ Èà <literal>declare</literal> + ÇäÕñðêÚÉî ÇäæñîÍèêñîÉî ÇäÎÇÕÉ ÈÈæÇÁÇÊ ÃÎÑé ääÊîÍãñïå ÈÇäÇæÓêÇÈ: <informalexample> <programlisting> <![CDATA[ -declare (directive) statement +declare (ÊèÌêç) ÈäÇÚ ]]> </programlisting> </informalexample> </para> <para> - The <literal>directive</literal> section allows the - behavior of the <literal>declare</literal> block to - be set. - Currently only one directive is recognized: the - <literal>ticks</literal> directive. (See below for more - information on the - <link linkend="control-structures.declare.ticks">ticks</link> - directive) + ÊÓåÍ áâÑÉ <literal>directive</literal> ÈÌÙä + Óäèã ãÊäÉ <literal>declare</literal> âÇÈäÇ + ääÅÙÏÇÏ. + ÍÇäêÇë¬ êïÊÙÑñîáï áâ× Ùäé ÊèÌêç èÇÍÏ: + ÊèÌêç <literal>ticks</literal>. (ÇÓÊÙÑÖ åÇ áê ÇäÃÓáä äÃÌä åÒêÏ åæ + ÇäåÙäèåÇÊ ÈÎÕèÕ + ÊèÌêç <link linkend="control-structures.declare.ticks">ticks</link> + ) </para> <para> - The <literal>statement</literal> part of the - <literal>declare</literal> block will be executed -- how - it is executed and what side effects occur during execution - may depend on the directive set in the - <literal>directive</literal> block. + Åæñî ÌÒÁ <literal>statement</literal> åæ + ãïÊäÉ <literal>declare</literal> ÓÊñïæáñîÐ - ãêá + êÊå ÊæáêÐçÇ¿ èåÇ çê ÇäÊñîÃËêÑÇÊ ÇäÌÇæÈêñîÉ ÇäÊñðê Ê×Ñà ÃËæÇÁ ÇäÊñîæáêп + çÐç åÓÇÆä ÊÑÊÈ× ÈÇäÊñîèÌêç ÇäåïÙñîÏ áê + ãïÊäÉ <literal>directive</literal>. </para> <para> - The <literal>declare</literal> construct can also be used in the global - scope, affecting all code following it. + êåãæ äÈæÇÁ <literal>declare</literal> Ãæ êïÓÊÎÏîå ÃêÖÇë áê + ÇäåÏé ÇäÔñîÇåðä¬ ååÇ êÄËðÑï áê åÌåä ÇäÔñðêáÑÉ ÇääÇÍâÉ Èç. <informalexample> <programlisting role="php"> <![CDATA[ <?php -// these are the same: +// ÊåËä çÐç æáÓ ÇäÔñîêÁ : -// you can use this: +// êåãæã ÇÓÊÎÏÇå çÐÇ: declare(ticks=1) { - // entire script here + // ãÇåä ÇäÎÇ×è× çæÇ } -// or you can use this: +// Ãè êåãæã ÇÓÊÎÏÇå çÐÇ: declare(ticks=1); -// entire script here +// ãÇåä ÇäÎÇ×è× çæÇ ?> ]]> </programlisting> @@ -1034,32 +1034,32 @@ </para> <sect2 id="control-structures.declare.ticks"> <title>Ticks</title> - <para>A tick is an event that occurs for every - <replaceable>N</replaceable> low-level statements executed - by the parser within the <literal>declare</literal> block. - The value for <replaceable>N</replaceable> is specified - using <literal>ticks=<replaceable>N</replaceable></literal> - within the <literal>declare</literal> blocks's - <literal>directive</literal> section. + <para>"tick" çè ÍÏË ê×ÑÃ ÙæÏ ãäñð + <replaceable>N</replaceable> ÈäÇÚÇÊ åæÎáÖÉ ÇäåÓÊèé êÊå ÊæáêÐçÇ + åæ âðÈä ÇäåïáÓñðÑ Öåæ ãÊäÉ <literal>declare</literal>. + ÊïÍÏñîÏï âêåÉï <replaceable>N</replaceable> + ÈÇÓÊÎÏÇå <literal>ticks=<replaceable>N</replaceable></literal> + Öåæ ãïÊä <literal>declare</literal> + èåÇ ÈçÇ åæ áâÑÉ <literal>directive</literal>. </para> <para> - The event(s) that occur on each tick are specified using the - <function>register_tick_function</function>. See the example - below for more details. Note that more than one event can occur - for each tick. + Åæñî ÇäÍÏË (ÇäÃÍÏÇË) ÇäÊñðê Ê×Ñà Ùäé ãäñ "tick" êÊå ÊÍÏêÏç ÈÇÓÊÎÏÇå + <function>register_tick_function</function>. ÇÓÊÙÑÖ ÇäåËÇä + ÇäÐê ÈÇäÃÓáä äåÒêÏ åæ ÇäÊñîáÇÕêä. äÇÍØ Ãæñîç êåãæ äÃãËÑ åæ ÍÏË èÇÍÏ Ãæ ê×Ñà + ÈÇäæñðÓÈÉ äãäñ "tick". </para> <para> <example> - <title>Profile a section of PHP code</title> + <title>ÅÊåÇå profile Ùäé áâÑÉí åæ ÔêáÑÉð PHP</title> <programlisting role="php"> <![CDATA[ <?php -// A function that records the time when it is called +// ÏÇäÉ ÊïÓÌñðäï ÇäèâÊ ÇäÐê ÊåÊ åæÇÏÇÊçÇ áêç function profile ($dump = FALSE) { static $profile; - // Return the times stored in profile, then erase it + // ÊïÑÌðÙï ÇäÃÒåæÉ ÇäåïÎÒñîæëÉ áê profile¬ èåæ Ëå ÊåÍèçÇ if ($dump) { $temp = $profile; unset ($profile); @@ -1069,39 +1069,39 @@ $profile[] = microtime (); } -// Set up a tick handler +// ÊæÕêÈ åðâÈÖ "tick" register_tick_function("profile"); -// Initialize the function before the declare block +// ÇÓÊçäÇä ÇäÏñîÇäÉ âÈä ãÊäÉ "declare" profile (); -// Run a block of code, throw a tick every 2nd statement +// ÊÔÚêä ãÊäÉ ÔêáÑɬ ÅäâÇÁ "tick" ÙæÏ ãäñ ÈäÇÚ ËÇæêñ declare (ticks=2) { for ($x = 1; $x < 50; ++$x) { echo similar_text (md5($x), md5($x*$x)), "<br />;"; } } -// Display the data stored in the profiler +// ÇØçÇÑ ÇäÈêÇæÇÊ ÇäåïÎÒñîæîÉ áê ÇäåïÔãñðä ÇäÌÇæÈêñ (profiler) print_r (profile (TRUE)); ?> ]]> </programlisting> </example> - The example profiles the PHP code within the 'declare' - block, recording the time at which every second low-level - statement in the block was executed. This information can - then be used to find the slow areas within particular - segments of code. This process can be performed using other - methods: using ticks is more convenient and easier to - implement. + êÑÊÓå ÇäåËÇä ÊÔãêä ÔêáÑÉ PHP ÏÇÎä ãÊäÉ 'declare'¬ + åïÓÌñðäÇë ÇäÒñîåæ ÇäÐê æïáñðÐî áêç ãäñï ÈäÇÚ ËÇæí åæ åÓÊèé åæÎáÖ + áê ÇäãïÊäÉ. ÍêæÆÐ¬ êåãæ äçÐç ÇäåÙäèåÇÊ + Ãæ ÊïÓÊÎÏîå äÇêÌÇÏ ÇäÈïâÙ ÇäÈ×êÆÉ Öåæ åâÇ×Ù + åïÍÏñîÏîÉ åæ ÇäÔñðêáÑÉ. êåãæ ÇÊåÇå çÐç ÇäåïÙÇäîÌÉ ÈÇÓæÎÏÇå åæÇçÌ + ÃÎÑé: êÓÊå ÇÓÊÎÏÇå "ticks" Èãèæç ÃãËÑ åäÇÁåÉ èÃÓçä + ääÊÖåêæ. </para> <simpara> - Ticks are well suited for debugging, implementing simple - multitasking, backgrounded I/O and many other tasks. + ÊÊÓå Çäà "Ticks" Èãèæç åäÇÆåÉ ÌêÏÉ äåÓÇÆÉ ÇÒÇäÉ ÇäÙðää¬ ÊÖåêæ + ÊÙÏñïÏ-åçÇå ÈÓê׬ ÅÏÎÇä/ÅÎÑÇÌ áê ÇäÎäáêÉ èåçÇå ÃÎÑé ÙÏêÏÉ. </simpara> <simpara> - See also <function>register_tick_function</function> and + ÇÓÊÙÑÖ ÃêÖÇ <function>register_tick_function</function> è <function>unregister_tick_function</function>. </simpara> </sect2> @@ -1110,38 +1110,38 @@ <sect1 id="function.return"> <title>return</title> <simpara> - If called from within a function, the <function>return</function> - statement immediately ends execution of the current function, and - returns its argument as the value of the function - call. <function>return</function> will also end the execution of - an <function>eval</function> statement or script file. - </simpara> - <simpara> - If called from the global scope, then execution of the current - script file is ended. If the current script file was - <function>include</function>ed or <function>require</function>ed, - then control is passed back to the calling file. Furthermore, if - the current script file was <function>include</function>ed, then - the value given to <function>return</function> will be returned as - the value of the <function>include</function> call. If - <function>return</function> is called from within the main script - file, then script execution ends. If the current script file was - named by the <link - linkend="ini.auto-prepend-file">auto_prepend_file</link> or <link + ÅÐÇ æèÏðêîÊ Çæ×äÇâÇë åæ ÏÇäɬ áÅæñî ÈäÇÚ <function>return</function> + êïæçðê ÍÇäÇ ÊæáêÐî ÇäÏñîÇäÉ ÇäÍÇäêñîÉ + èêïÑÌðÙï Ïäêäç Ùäé Ãæñîç âêåÉ æÏÇÁ + ÇäÏñîÇäÉ. Êïæçðê <function>return</function> ÃêÖÇë ÊæáêÐî ÈäÇÚ + <function>eval</function> Ãè åäá ÇäÎÇ×è×. + </simpara> + <simpara> + ÅÐÇ æèÏêÊ Åæ×äÇâÇë åæ ÇäåÏé ÇäÔñîÇåðä¬ áÅæñîç êÊå ÅæçÇÁ ÊæáêÐ åäá + ÇäÎÇ×è× ÇäÍÇäêñ. ÅÐÇ ãÇæ åäá ÇäÎÇ×è× ÇäÍÇäêñ + åÍä <function>include</function> Ãè <function>require</function> (ÈÕêÚÉ ÇäåáÙèä)¬ + áÅæñîç êÊå ÊåÑêÑ ÇäÊñîÍãñïå åæ ÌÏêÏ Åäé Çäåäá ÇäåïæÇÏðêñ. ÙäÇèÉ Ùäé Ðä㬠ÅÐÇ + åäá ÇäÎÇ×è× ÇäÍÇäêñ åÍä <function>include</function> (ÈÕêÚÉ ÇäåáÙèä)¬ áÅæñî + ÇäâêåÉ ÇäåïÙò×îÇÉ äà <function>return</function> ÓêÊå ÇÑÌÇÙçÇ Ùäé ÃæñîçÇ + âêåÉ æÏÇÁ <function>include</function>. ÅÐÇ + æèÏðêîÊ <function>return</function> Çæ×äÇâÇë åæ åäá ÇäÎÇ×è× + ÇäÑñîÆêÓêñ¬ êæÊçê ÍêæçÇ ÊæáêÐ ÇäÎÇ×è×. ÅÐÇ ÇÓÊïÏòÙðêî åäá ÇäÎÇ×è× ÇäÍÇäêñ + åæ âÈä ÎêÇÑÇÊ ÊçêÆÉ <link + linkend="ini.auto-prepend-file">auto_prepend_file</link> Ãè <link linkend="ini.auto-append-file">auto_append_file</link> - configuration options in &php.ini;, - then that script file's execution is ended. + áê &php.ini;¬ + êïæòçîé ÍêæçÇ ÊæáêÐ çÐÇ Çäåäá ÇäÎÇ×è×. </simpara> - <simpara>For more information, see <link - linkend="functions.returning-values">Returning values</link>. + <simpara>äåÒêÏ åæ ÇäåÙäèåÇʬ ÇÓÊÙÑÖ <link + linkend="functions.returning-values">ÇÑÌÇÙ Çäâðêîå</link>. </simpara> <para> <note> <simpara> - Note that since <function>return</function> is a language - construct and not a function, the parentheses surrounding its - arguments are <emphasis>only</emphasis> required if the argument - contains an expression. It is common to leave them out while returning a variable. + äÇÍØ Ãæñîç æØÑÇ äÃæñî <function>return</function> çê ÙÈÇÑÉ Ùæ ÈæÇÁ äÚèêñ + èäêÓÊ ÏÇäÉë¬ áÅæî ÇäÃâèÇÓ ÇäåïÍðê×îÉ + ÈÃÏäÊçÇ çê <emphasis>áâ×</emphasis> å×äèÈÉ ÅÐÇ ãÇæ ÇäÏñîäêä + êÍÊèê Ùäé ÙÈÇÑÉ. åæ ÇäåïÙÊÇÏ ÇçåÇäçÇ ÙæÏ ÇÑÌÇÙ åÊÚêñðÑ. </simpara> </note> </para> @@ -1152,29 +1152,29 @@ <title><function>require</function></title> <simpara> - The <function>require</function> statement includes and evaluates - the specific file. + êÊÖåæ ÈäÇÚ <function>require</function> èêïâêñðå + Çäåäá ÇäåïÍÏñîÏ. </simpara> <simpara> - <function>require</function> includes and evaluates a specific file. - Detailed information on how this inclusion works is described in the - documentation for <function>include</function>. - </simpara> - <simpara> - <function>require</function> and <function>include</function> - are identical in every way except how they handle failure. - <function>include</function> produces a - <link linkend="internal.e-warning">Warning</link> while - <function>require</function> results in a <link linkend="internal.e-error"> - Fatal Error</link>. In other words, don't hesitate to use - <function>require</function> if you want a missing file to halt processing - of the page. <function>include</function> does not behave this way, the - script will continue regardless. Be sure to have an appropriate - <link linkend="ini.include-path">include_path</link> setting as well. + ÊÊÖåæ <function>require</function> èÊïâêñðå åäáÇë åïÍÏñîÏÇë. + åÙäèåÇÊ åïáÕñîäîÉ Ùæ ãêáêÉ Ùåä çÐÇ ÇäÊñîÖåêæ çê åÍä èÕá áê + ÇäÊñîèËêâ ÇäÎÇÕ Èà<function>include</function>. + </simpara> + <simpara> + ÊÊÓðå <function>require</function> è <function>include</function> + êÊåÇËäçåÇ åæ ãäñ ÇäÌçÇÊ áêåÇ ÙÏÇ Çä×ñîÑêâÉ ÇäÊñðê ÊÊÙÇåäÇæ ÈçÇ åÙ ÇäÇÎáÇâÇÊ. + ÊïæÊðÌï <function>include</function> + <link linkend="internal.e-warning">ÊÍÐêÑÇë - Warning</link> áê Íêæ Ãæñî + <function>require</function> ÊïÄÏðê Åäé <link linkend="internal.e-error"> + Î×à áÇÏðÍ - Fatal Error</link>. ÈãäåÇÊ ÃÎÑé¬ äÇ ÊÊÑÏÏ áê ÇÓÊÎÏÇå + <function>require</function> ÅÐÇ ãæÊ ÊÑÚÈ åæ åäá åáâèÏ Ãæ êèâá åÙÇäÌÉ + ÇäÕñîáÍÉ. äÇ ÊÊÕÑá <function>include</function> ÈçÐç Çä×Ñêâɬ ÅÐ Ãæñî + ÇäÎÇ×è× ÓêÓÊåѬ åçåÇ êãïæ. ÊÃãñîÏ åæ ÊèáÑã Ùäé ÅÙÏÇÏ + <link linkend="ini.include-path">include_path</link> åæÇÓÈ ãåÇ êäÒå ÇäÍÇä. </simpara> <para> <example> - <title>Basic <function>require</function> examples</title> + <title>ÃåËäÉ âÇÙÏêñîÉ Ùæ <function>require</function></title> <programlisting role="php"> <![CDATA[ <?php @@ -1183,7 +1183,7 @@ require $somefile; -require ('somefile.txt'); +require ('ismoumilef.txt'); ?> ]]> @@ -1191,20 +1191,20 @@ </example> </para> <simpara> - See the <function>include</function> documentation for more examples. + ÇÓÊÙÑÖ ÊèËêâ <function>include</function> äåÒêÏ åæ ÇäÃåËäÉ. </simpara> <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. + âÈä PHP 4.0.2¬ ãÇæ åÇ êäê ÓÇÑê ÇäåáÙèä: ÓÊâèå <function>require</function> + ÏèåÇ ÈåÍÇèäÉ âÑÇÁÉ Çäåäá ÇäåïÓÊçÏîá ÍÊé èÅæ ãÇæ ÇäÓñî×Ñ ÇäÐê ÊÊèÇÌÏ Èç + êÓÊÍêä ÊæáêÐç. äæ êÄËÑ ÇäÈäÇÚ ÇäÔñîÑ×êñ áê + <function>require</function>. åÙ Ðä㬠ÅÐÇ äå êÊå ÊæáêÐ ÇäÓñî×Ñ ÇäÐê Ê×Ñà áêç + <function>require</function>¬ áäæ êÊå ÊæáêÐ Ãêñ åæ + ÇäÔñðêáÑÉ áê Çäåäá ÇäåïÓÊçÏîá. ãÐä㬠äÇ ÊïÄîËðÑï ÇäÈïæé ÇäÍäâêñîÉ + áê Óäèã <function>require</function>. ÈÇäÑñîÚå åæ Ãæñî + ÇäÔñðêáÑÉ ÇäåïÍÊèÇÉ áê Çäåäá ÇäåïÓÊçÏîá äÇ ÊÒÇä ÙïÑòÖîÉ äÃæ Êãèæ Íäâɬ ÅäÇ Ãæñî + <function>require</function> æáÓçÇ ÊÍÏË áâ× åÑÉ èÇÍÏÉ. </simpara> </note> </para> @@ -1214,58 +1214,58 @@ &warn.no-win32-fopen-wrapper; <simpara> - See also <function>include</function>, <function>require_once</function>, - <function>include_once</function>, <function>eval</function>, - <function>file</function>, <function>readfile</function>, - <function>virtual</function> and <link linkend="ini.include-path">include_path</link>. + ÇÓÊÙÑÖ ÃêÖÇ <function>include</function>¬ <function>require_once</function>¬ + <function>include_once</function>¬ <function>eval</function>¬ + <function>file</function>¬ <function>readfile</function>¬ + <function>virtual</function> è <link linkend="ini.include-path">include_path</link>. </simpara> </sect1> <sect1 id="function.include"> <title><function>include</function></title> <simpara> - The <function>include</function> statement includes and evaluates - the specified file. + êÊÖåæ ÈäÇÚ <function>include</function> èêïâêñðå + Çäåäá ÇäåïÍÏñîÏ. </simpara> <simpara> - The documentation below also applies to <function>require</function>. - The two constructs are identical in every way except how they handle - failure. <function>include</function> produces a - <link linkend="internal.e-warning">Warning</link> while <function>require</function> - results in a <link linkend="internal.e-error">Fatal Error</link>. - In other words, use <function>require</function> if you want - a missing file to halt processing of the page. <function>include</function> does - not behave this way, the script will continue regardless. Be sure to have an - appropriate <link linkend="ini.include-path">include_path</link> setting as well. - </simpara> - <simpara> - When a file is included, the code it contains inherits the - <link linkend="language.variables.scope">variable scope</link> of the - line on which the include occurs. Any variables available at that line - in the calling file will be available within the called file, from that - point forward. + åÇ êÃÊê åæ ÊèËêâ êæ×Èâ ÃêÖÇ Ùäé <function>require</function>. + ÇäÈæÇÁÇæ åÊåÇËäÇæ áê ãäñ ÇäæñîèÇÍê áêåÇ ÙÏÇ Çä×ñîÑêâÉ ÇäÊê êÊÙÇåäÇæ ÈçÇ + åÙ ÇäÇÎáÇâÇÊ. ÊïæÊðÌï <function>include</function> + <link linkend="internal.e-warning">ÊÍÐêÑÇë - Warning</link> áê Íêæ Ãæñî <function>require</function> + ÊïÄÏðê Åäé <link linkend="internal.e-error">Î×à áÇÏðÍ - Fatal Error</link>. + ÈãäåÇÊ ÃÎÑé¬ ÇÓÊÎÏå <function>require</function> ÅÐÇ ãïæÊî ÊÑÚÈ + åæ åäá åáâèÏ Ãæ êèâðáî åÙÇäÌÉ ÇäÕñîáÍÉ. äÇ ÊÊÕÑá <function>include</function> + ÈçÐç Çä×ñîÑêâɬ ÅÐ Ãæñî ÇäÎÇ×è× ÓêÓÊåѬ åçåÇ êãïæ. ÊÃãñîÏ åæ ÊèáÑã Ùäé ÅÙÏÇÏ + appropriate <link linkend="ini.include-path">include_path</link> åïæÇÓÈ ãåÇ êäÒå. + </simpara> + <simpara> + ÙæÏåÇ êÊå ÊÖåêæ åäá åǬ áÅæñî ÇäÔñðêáÑÉ ÇäÊñðê êÍÊèêçÇ ÊîÑðËï + <link linkend="language.variables.scope">åÏé ÇäåïÊÚêñðÑÇÊ</link> ÇäÎÇÕ + ÈÇäÓñî×Ñ ÇäÐê ×Ñà áêç ÇäÊñîÖåêæ. ÃêñîÉ åÊÚêñðÑÇÊ Êãèæ åïÊÇÍîÉ ÙæÏ çÐÇ ÇäÓñî×Ñ + áê Çäåäá ÇäåïæÇÏðê ÓÊãèæ ãÐäã áê Çäåäá ÇäåïæÇÏîé¬ Çæ×äÇâÇ åæ çÐç + ÇäèçäÉ áåÇ ÈÙÏ. </simpara> <para> <example> - <title>Basic <function>include</function> example</title> + <title>åËÇä âÇÙÏêñ Ùæ <function>include</function></title> <programlisting role="php"> <![CDATA[ vars.php <?php -$color = 'green'; -$fruit = 'apple'; +$color = 'ÎÖÑÇÁ'; +$fruit = 'ÊáÇÍÉ'; ?> test.php <?php -echo "A $color $fruit"; // A +echo "Çäà $color $fruit"; // Çä include 'vars.php'; -echo "A $color $fruit"; // A green apple +echo "Çäà $color $fruit"; // Çäà ÎÖÑÇÁ ÊáÇÍÉ ?> ]]> @@ -1273,14 +1273,14 @@ </example> </para> <simpara> - If the include occurs inside a function within the calling file, - then all of the code contained in the called file will behave as - though it had been defined inside that function. So, it will follow - the variable scope of that function. + ÅÐÇ ×Ñà ÇäÊñîÖåêæ áê Å×ÇÑ ÏÇäÉ ÏÇÎä Çäåäá ÇäåïæÇÏðê¬ + ÍêæçǬ ÓêÊÕÑá åïÌåîäï ÇäÔñðêáÑÉ ÇäåïÍÊèÇÉ áê Çäåäá ÇäåïæÇÏîé èãÃæñîç + âÏ Êå ÊÙÑêáç Öåæ Êäã ÇäÏñîÇäÉ. äÐä㬠áÅæñîç ÓêÊÈÙ + åÏé ÇäåïÊÚêñðÑÇÊ ÇäÎÇÕ ÈÊäã ÇäÏñîÇäÉ. </simpara> <para> <example> - <title>Including within functions</title> + <title>ÇäÊñîÖåêæ áê Å×ÇÑ ÇäÏñîèÇä</title> <programlisting role="php"> <![CDATA[ <?php @@ -1291,16 +1291,16 @@ include 'vars.php'; - echo "A $color $fruit"; + echo "Çäà $color $fruit"; } -/* vars.php is in the scope of foo() so * - * $fruit is NOT available outside of this * - * scope. $color is because we declared it * - * as global. */ +/* ÊâÙ vars.php áê åÏé foo() ÈÍêË Ãæñî * + * $fruit äêÓÊ åïÊÇÍÉ ÎÇÑÌ çÐÇ * + * ÇäåÏé. $color çê ãÐäã äÃæñîæÇ ÕÑñî꾂 ÈçÇ * + * Ùäé ÃæñîçÇ ÔÇåäÉ. */ -foo(); // A green apple -echo "A $color $fruit"; // A green +foo(); // Çäà ÎÖÑÇÁ ÊáÇÍÉ +echo "A $color $fruit"; // Çäà ÎÖÑÇÁ ?> ]]> @@ -1308,25 +1308,25 @@ </example> </para> <simpara> - When a file is included, parsing drops out of PHP mode and - into HTML mode at the beginning of the target file, and resumes - again at the end. For this reason, any code inside the target - file which should be executed as PHP code must be enclosed within - <link linkend="language.basic-syntax.phpmode">valid PHP start - and end tags</link>. - </simpara> - <simpara> - If "<link linkend="ini.allow-url-fopen">URL fopen wrappers</link>" - are enabled in PHP (which they are in the default configuration), - you can specify the file to be included using an URL (via HTTP or - other supported wrapper - see <xref linkend="wrappers"/> for a list - of protocols) instead of a local pathname. If the target server interprets - the target file as PHP code, variables may be passed to the included - file using an URL request string as used with HTTP GET. This is - not strictly speaking the same thing as including the file and having - it inherit the parent file's variable scope; the script is actually - being run on the remote server and the result is then being - included into the local script. + ÙæÏåÇ êïÊîÖîåîæï åäá åǬ áÅæñî ÇäÊñîáÓêÑ êÊåäÕ åæ èÖÙ PHP èêÏÎä + èÖÙ HTML ÙæÏ åïÓÊçä Çäåäá ÇäåïÓÊçÏîᬠèêÓÊÃæá + åæ ÌÏêÏ Åäé ÚÇêÉ ÇäæñðçÇêÉ. äçÐÇ ÇäÓñîÈȬ áÅæñî ÃêñîÉ ÔðêáÑÉ ÊÊèÇÌÏ ÈÇäåäá + ÇäåïÓÊçÏîá èêÊèÌÈ ÊæáêÐçÇ Ùäé ÃæñîçÇ ÔêáÑÉ PHP êÌÈ Ê×èêâçÇ Öåæ + <link linkend="language.basic-syntax.phpmode">èÓèå ÕÇäÍÉ äÈÏÁ èÇæçÇÁ + PHP</link>. + </simpara> + <simpara> + ÅÐÇ ãÇæÊ "<link linkend="ini.allow-url-fopen">URL fopen wrappers</link>" + åïáÙñîäîÉ áê PHP (èÐäã çè ÇäÍÇä áê ÇäÊñîçêÆÉ ÇäÇáÊÑÇÖêñîÉ)¬ + áÅæñîç êãèæ ÈÇåãÇæã ÊÍÏêÏ Çäåäá ÇäåÊèÌÈ ÊÖåêæç ÈÇÓÊÎÏÇå åïÍÏñðÏ åèÑÏ åïÊÔÇãðä "URL" (åæ ÎäÇä åÑÓèå æâä ÇäæñÕ ÇäåïÊîÔîÙñðÈ "HTTP" Ãè + åïÚäñðáí åÏÙèåí ÂÎÑ - ÇÓÊÙÑÖ <xref linkend="wrappers"/> ääÍÕèä Ùäé äÇÆÍÉ + ÇäåÑÇÓêå) ÈÏäÇ åæ ÇÓå åÓÇÑ åÍäêñ. ÅÐÇ ãÇæ ÇäÎÇÏå ÇäåïÓÊçÏîá êïÄèðäï + Çäåäá ÇäåïÓÊçÏîá Ùäé Ãæñîç ÔêáÑÉ PHP¬ áÅæñîç êåãæ ÊåÑêÑ ÇäåïÊÚêñðÑÇÊ ÈÇÊÌÇç Çäåäá + ÇäåïÊÖñîåîæ ÈÇÓÊÎÏÇå ÓäÓäÉ ×äÈêÇÊ åïÍÏñðÏÇÊ ÇäåèÇÑÏ ÇäåïÊÔÇãðäîÉ "URL request string" åËäåÇ êïÓÊîÎÏîå åÙ HTTP GET. äÇ êÙæê çÐÇ + ÇäãäÇå¬ â×ÙÇë¬ æáÓ ÇäÔñîêÁ åËäåÇ ÇäÍÇä ÙæÏ ÊÖåêæ Çäåäá èÌÙäç + êîÑðËï åÏé ÇäåÊÚêñðÑÇÊ ÇäÎÇÕ ÈÇäåäá ÇäâÑêÈ» ÇäÎÇ×è× çè ÇäÂæ + åÍä ÊÔÚêä Ùäé ÇäÎÇÏå ÇäÈñïÙÏêñ èÇäæñîÊêÌÉ ÍêæçÇ êÊå + ÊÖåêæçÇ Öåæ ÇäÎÇ×è× ÇäåÍäêñ. </simpara> &warn.no-win32-fopen-wrapper; <para> @@ -1336,53 +1336,53 @@ <![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. */ - -// 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'; - -// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the -// local filesystem. -include 'file.php?foo=1&bar=2'; +/* êáÊÑñðÖï çÐÇ ÇäåËÇä Ãæñî www.example.com âÏ çïêÆ äÊáÓêÑ åäáÇÊ .php + * èäêÓ åäáÇÊ .txt . ãÐä㬠êïâÕîÏ Èà 'êÙåä' çæÇ Ãæñî ÇäåïÊÚêñðÑÇÊ + * $foo è $bar åïÊÇÍÉ áê Å×ÇÑ Çäåäá ÇäåïÊîÖîåîæ. */ + +// äæ êÙåä» äå êÊå ÇäÊñîÙÇåä åÙ milef.txt åæ âÈä www.example.com Ùäé Ãæñîç PHP +include 'http://www.example.com/milef.txt?foo=1&bar=2'; + +// äæ êÙåä» êÈÍË Ùæ åäá êïÏòÙîé 'file.php?foo=1&bar=2' Ùäé +// æØÇå ÇäåäáÇÊ ÇäåÍäêñ. +include 'milef.php?foo=1&bar=2'; -// Works. -include 'http://www.example.com/file.php?foo=1&bar=2'; +// êÙåä. +include 'http://www.example.com/milef.php?foo=1&bar=2'; $foo = 1; $bar = 2; -include 'file.txt'; // Works. -include 'file.php'; // Works. +include 'milef.txt'; // êÙåä. +include 'milef.php'; // êÙåä. ?> ]]> </programlisting> </example> - See also <link linkend="features.remote-files">Remote files</link>, - <function>fopen</function> and <function>file</function> for related - information. + ÇÓÊÙÑÖ ÃêÖÇë <link linkend="features.remote-files">ÇäåäáÇÊ ÇäÈñïÙÏêñîÉ</link>¬ + <function>fopen</function> è <function>file</function> ääÍÕèä Ùäé åÙäèåÇÊ + ÐÇÊ ÕðäÉ. </para> <para> - Because <function>include</function> and <function>require</function> - are special language constructs, you must enclose them within a statement - block if it's inside a conditional block. + æØÑÇë äÃæñî <function>include</function> è <function>require</function> + ÊïÙòÊîÈîÑ ÈæÇÁÇÊ äïÚèêñîÉ ÎÇÕɬ áÅæñîç êÌÈ Ùäêã Ê×èêâçÇ Öåæ ãÊäÉ + ÈäÇÚêñîÉ ÅÐÇ ãÇæÊ Öåæ ãïÊäÉ ÔîÑ×êñîÉ. </para> <para> <example> - <title>include() and conditional blocks</title> + <title>include() èÇäãïÊä ÇäÔñîÑ×êñîÉ</title> <programlisting role="php"> <![CDATA[ <?php -// This is WRONG and will not work as desired. +// êïÙÊîÈîÑ çÐÇ ÎÇׯÇë èäæ êÙåä ãåÇ êïÑÇÏ åæç. if ($condition) include $file; else include $other; -// This is CORRECT. +// êïÙÊîÈîÑ çÐÇ ÕÍêÍÇë. if ($condition) { include $file; } else { @@ -1395,24 +1395,24 @@ </example> </para> <simpara> - Handling Returns: It is possible to execute a <function>return</function> - statement inside an included file in order to terminate processing in that - file and return to the script which called it. Also, it's possible to return - values from included files. You can take the value of the include call as - you would a normal function. + ÇäÊñîÙÇåä åÙ ÇäÇÑÌÇÙÇÊ: ÅÐÇ ãÇæ åæ Çäååãæ ÊæáêÐ ÈäÇÚ <function>return</function> + Öåæ åäá åïÊîÖîåñîæ èÐäã ÈÚÑÖ ÅêâÇá ÇäåÙÇäÌÉ áê Ðäã + Çäåäá èÇäÑñïÌèÙ Åäé ÇäÎÇ×è× ÇäÐê æÇÏÇç. ãÐä㬠áÅæñîç åæ Çäååãæ ÇÑÌÇÙ + âêå Çæ×äÇâÇë åæ ÇäåäáÇÊ ÇäåïÊÖîåñîæîÉ. êåãæã ÃÎÐ âêåÉ æÏÇÁ "include" åËäåÇ + ÊáÙä åÙ ÏÇäÉ ÙÇÏêñîÉ. </simpara> <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. + áê PHP 3¬ êåãæ ääÇÑÌÇÙ Ãæ äÇ êØçÑ Öåæ ãïÊäÉ ÅäÇ ÅÐÇ ãÇæ ÙÈÇÑÉ Ùæ + ãÊäÉ ÏÇäɬ ÍêË Êæ×Èâ <function>return</function> + Ùäé Êäã ÇäÏñîÇäÉ èäêÓ Ùäé åïÌåîä Çäåäá. </simpara> </note> </para> <para> <example> - <title><function>include</function> and the <function>return</function> statement</title> + <title><function>include</function> èÈäÇÚ <function>return</function></title> <programlisting role="php"> <![CDATA[ return.php @@ -1436,11 +1436,11 @@ $foo = include 'return.php'; -echo $foo; // prints 'PHP' +echo $foo; // ê×ÈÙ 'PHP' $bar = include 'noreturn.php'; -echo $bar; // prints 1 +echo $bar; // ê×ÈÙ 1 ?> ]]> @@ -1448,21 +1448,21 @@ </example> </para> <simpara> - <literal>$bar</literal> is the value <literal>1</literal> because the include - was successful. Notice the difference between the above examples. The first uses - <function>return</function> within the included file while the other does not. - A few other ways to "include" files into variables are with - <function>fopen</function>, <function>file</function> or by using - <function>include</function> along with - <link linkend="ref.outcontrol">Output Control Functions</link>. + <literal>$bar</literal> çê ÇäâêåÉ <literal>1</literal> äÃæñî ÇäÊñîÖåêæ + ãÇæ æÇÌÍÇ. äÇÍØ ÇäáÑâ Èêæ ÇäÃåËäÉ ÇäÙïäêÇ. êÓÊÎÏå ÇäåËÇä ÇäÃèäï + <function>return</function> Öåæ Çäåäá ÇäåïÊîÖîåñîæ áê Íêæ Ãæñî ÇäÃåËäÉ ÇäÃÎÑé äÇ Êâèå ÈÐäã. + çæÇã ÈÖÙÉ ×Ñâ ÃÎÑé äà "ÊÖåêæ - include" åäáÇÊ Öåæ åÊÚêñîÑÇÊ èÊÊåËä áê + <function>fopen</function>¬ <function>file</function> Ãè ÈÇÓÊÎÏÇå + <function>include</function> ÈÑáâÉ + <link linkend="ref.outcontrol">ÏèÇä ÇäÊñîÍãñïå áê ÇäåïÎÑÌÇÊ</link>. </simpara> &note.language-construct; <simpara> - See also <function>require</function>, <function>require_once</function>, - <function>include_once</function>, <function>readfile</function>, - <function>virtual</function>, and + ÇÓÊÙÑÖ ÃêÖÇ <function>require</function>, <function>require_once</function>¬ + <function>include_once</function>¬ <function>readfile</function>¬ + <function>virtual</function> è <link linkend="ini.include-path">include_path</link>. </simpara> </sect1> @@ -1470,47 +1470,47 @@ <sect1 id="function.require-once"> <title><function>require_once</function></title> <para> - The <function>require_once</function> statement includes and evaluates - the specified file during the execution of the script. - This is a behavior similar to the <function>require</function> statement, - with the only difference being that if the code from a file has already - been included, it will not be included again. See the documentation for - <function>require</function> for more information on how this statement - works. - </para> - <para> - <function>require_once</function> should be used in cases where - the same file might be included and evaluated more than once during a - particular execution of a script, and you want to be sure that it is - included exactly once to avoid problems with function redefinitions, - variable value reassignments, etc. - </para> - <para> - For 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. + êÊÖåæ ÈäÇÚï <function>require_once</function> èêïâêñðåï + Çäåäá ÇäåïÍÏñîÏ ÎäÇä ÊæáêÐ ÇäÎÇ×è×. + êïÙÊîÈîÑï çÐÇ ÓäèãÇ ÔÈêçÇ ÈÓäèã ÈäÇÚ <function>require</function> + åÙ áÑâ èÍêÏ êÊåËä áê Ãæñî ÔðêáÑÉ Çäåäá ÅÐÇ ÓÈâ èÃæ Êåñî + ÊÖåêæçǬ áÅæñîç äæ êÊå ÊÖåêæçÇ åïÌÏÏÇë. ÇÓÊÙÑÖ ÇäÊñîèËêâ ÇäÎÇÕ Èà + <function>require</function> äÃÌä åÒêÏ åæ ÇäåÙäèåÇÊ Ùæ ÇäãêáêÉ ÇäÊñðê êÙåä ÈçÇ çÐÇ + ÇäÈäÇÚ. + </para> + <para> + êÌÈ ÇÓÊÎÏÇå <function>require_once</function> áê ÍÇäÇÊ êåãæ ÎäÇäçÇ + ÊÖåêæ èÊâêêå æáÓ Çäåäá ÃãËÑ åæ åÑÉ áê ÃËæÇÁ + ÊæáêÐ ÎÇÕ äÎÇ×è× åÇ èÙæÏåÇ ÊÑÚÈ áê ÇäÊñîàÃãñïÏ åæ Ãæñîç âÏ Êåñî + ÊÖåêæç¬ ÊÏâêâÇë¬ åÑÉ èÇÍÏÉ äÊÌæÈ ÍÏèË åÔÇãä ÙæÏ ÅÙÇÏÉ ÊÙÑêá ÇäÏñîèÇä¬ + ÅÙÇÏÉ ÊÙêêæ âêå ÇäåÊÚêñðÑÇʬ ÇäÎ. + </para> + <para> + ääÍÕèä Ùäé ÃåËäÉ ÈÎÕèÕ ÇÓÊÎÏÇå <function>require_once</function> è + <function>include_once</function>¬ Ç×äÙ Ùäé + ÔðàêáÑÉ <ulink url="&url.php.pear;">PEAR</ulink> ÇäåïÊÖîåñîæîÉ áê + ÊèÒêÙÇÊ ÔðêáÑÉ PHP ÇäåÕÏÑêñîÉ ÇäÃÎêÑÉ. </para> <para> <note> <para> - <function>require_once</function> was added in PHP 4.0.1pl2 + ÃÖêáÊ <function>require_once</function> áê 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). + ÇÍÐÑ äÃæñî Óäèã <function>require_once</function> + è <function>include_once</function> êåãæ Ãæ äÇ êãèæ åËäåÇ ÊÊèâÙ + áê æØÇå ÊÔÚêä ÚêÑ åïÊÍÓñðÓ äÍÇäÉ ÇäÍÑèá (åËä Windows). <example> - <title><function>require_once</function> is case insensitive on Windows</title> + <title>ÊÊÓå <function>require_once</function> ÈãèæçÇ åïÊÍÓñðÓîÉ äÍÇäÉ ÇäÍÑèá áê Windows</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! +require_once("a.php"); // Óêâèå çÐÇ ÈÊîÖîåñïæ a.php +require_once("A.php"); // Óêâèå çÐÇ ÈÊîÖîåñïæ a.php åæ ÌÏêÏ Ùäé Windows! ?> ]]> </programlisting> @@ -1520,10 +1520,10 @@ </para> &warn.no-win32-fopen-wrapper; <para> - See also <function>require</function>, - <function>include</function>, <function>include_once</function>, - <function>get_required_files</function>, - <function>get_included_files</function>, <function>readfile</function>, and + ÇÓÊÙÑÖ ÃêÖÇ <function>require</function>¬ + <function>include</function>¬ <function>include_once</function>¬ + <function>get_required_files</function>¬ + <function>get_included_files</function>¬ <function>readfile</function> è <function>virtual</function>. </para> </sect1> @@ -1531,46 +1531,46 @@ <sect1 id="function.include-once"> <title><function>include_once</function></title> <para> - The <function>include_once</function> statement includes and evaluates - the specified file during the execution of the script. - This is a behavior similar to the <function>include</function> statement, - with the only difference being that if the code from a file has already - been included, it will not be included again. As the name suggests, - it will be included just once. - </para> - <para> - <function>include_once</function> should be used in cases where - the same file might be included and evaluated more than once during a - particular execution of a script, and you want to be sure that it is - included exactly once to avoid problems with function redefinitions, - 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. + êÊÖåæ ÈäÇÚ <function>include_once</function> èêïâêñðåï + Çäåäá ÇäåïÍÏñîÏ ÎäÇä ÊæáêÐ ÇäÎÇ×è×. + êïÙÊîÈîÑï çÐÇ ÓäèãÇ ÔÈêçÇ ÈÓäèã ÈäÇÚ <function>include</function> + åÙ áÑâ èÍêÏ êÊåËä áê Ãæñî ÔðêáÑÉ Çäåäá ÅÐÇ ÓÈâ èÃæ Êåñî + ÊÖåêæçǬ áÅæñîç äæ êÊå ÊÖåêæçÇ åïÌÏÏÇë. åËäåÇ êèÍê Èç ÇäÅÓå¬ + áäæ êÊå ÊÖåêæç ÅäÇ åÑÉ èÇÍÏÉ. + </para> + <para> + êÌÈ ÇÓÊÎÏÇå <function>include_once</function> áê ÍÇäÇÊ êåãæ ÎäÇäçÇ + ÊÖåêæ èÊâêêå æáÓ Çäåäá ÃãËÑ åæ åÑÉ áê ÃËæÇÁ + ÊæáêÐ ÎÇÕ äÎÇ×è× åÇ èÙæÏåÇ ÊÑÚÈ áê ÇäÊñîàÃãñïÏ åæ Ãæñîç âÏ Êåñî + ÊÖåêæç¬ ÊÏâêâÇë¬ åÑÉ èÇÍÏÉ äÊÌæÈ ÍÏèË åÔÇãä ÙæÏ ÅÙÇÏÉ ÊÙÑêá ÇäÏñîèÇä¬ + ÅÙÇÏÉ ÊÙêêæ âêå ÇäåÊÚêñðÑÇʬ ÇäÎ. + </para> + <para> + äåÒêÏ åæ ÇäÃåËäÉ ÈÎÕèÕ ÇÓÊÎÏÇå <function>require_once</function> è + <function>include_once</function>¬ Ç×äÙ Ùäé + ÔðêáÑÉ <ulink url="&url.php.pear;">PEAR</ulink> ÇäåïÊÖîåñîæîÉ áê ÊèÒêÙÇÊ + ÔðêáÑÉ PHP ÇäåÕÏÑêñîÉ ÇäÃÎêÑÉ. </para> <para> <note> <para> - <function>include_once</function> was added in PHP 4.0.1pl2 + ÃÖêáÊ <function>include_once</function> áê PHP 4.0.1pl2 </para> </note> </para> <para> <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). + ÇÍÐÑ äÃæñî Óäèã <function>include_once</function> + è <function>require_once</function> êåãæ Ãæ äÇ êãèæ åËäåÇ ÊÊèâÙ + áê æØÇå ÊÔÚêä ÚêÑ åïÊÍÓñðÓ äÍÇäÉ ÇäÍÑèá (åËä Windows). <example> - <title><function>include_once</function> is case insensitive on Windows</title> + <title>ÊïÙÊîÈîÑ <function>include_once</function> åïÊÍÓñðÓîÉ äÍÇäÉ ÇäÍÑèá áê Windows</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! +include_once("a.php"); // Óêâèå çÐÇ ÈÊîÖîåñïæ a.php +include_once("A.php"); // Óêâèå çÐÇ ÈÊîÖîåñïæ a.php åæ ÌÏêÏ Ùäé Windows! ?> ]]> </programlisting> @@ -1580,11 +1580,11 @@ </para> &warn.no-win32-fopen-wrapper; <para> - See also <function>include</function>, - <function>require</function>, <function>require_once</function>, - <function>get_required_files</function>, - <function>get_included_files</function>, <function>readfile</function>, - and <function>virtual</function>. + ÇÓÊÙÑÖ ÃêÖÇë <function>include</function>¬ + <function>require</function>¬ <function>require_once</function>¬ + <function>get_required_files</function>¬ + <function>get_included_files</function>¬ <function>readfile</function> + è <function>virtual</function>. </para> </sect1>
« previous php.doc.ar (#593) next »