cvs: phpdoc-ar /language types.xml

From: Date: Sat, 20 Sep 2003 05:58:49 +0000
Subject: cvs: phpdoc-ar /language types.xml
Groups: php.doc.ar 
Request: Send a blank email to doc-ar+get-573@lists.php.net to get a copy of this message
hafid Sat Sep 20 01:58:49 2003 EDT Modified files: /phpdoc-ar/language types.xml Log: 7th Partial Translation. Still EN-1.123 compliant.

Index: phpdoc-ar/language/types.xml diff -u phpdoc-ar/language/types.xml:1.6 phpdoc-ar/language/types.xml:1.7 --- phpdoc-ar/language/types.xml:1.6 Fri Sep 19 19:27:53 2003 +++ phpdoc-ar/language/types.xml Sat Sep 20 01:58:49 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-6"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- EN-Revision: 1.123 Maintainer: hafid Status: working --> <chapter id="language.types"> <title>ÇäÃæèÇÙ</title> @@ -1535,30 +1535,30 @@ print "ÃçäÇ {$arr[fruit]}"; // ÃçäÇ carrot print "ÃçäÇ {$arr['fruit']}"; // ÃçäÇ apple -// This will not work, results in a parse error such as: +// äæ êÙåä çÐǬ ÓêÊÓÈÈ áê Î×à ÊáÓêÑêñ åËä: // Parse error: parse error, expecting T_STRING' or T_VARIABLE' or T_NUM_STRING' -// This of course applies to using autoglobals in strings as well +// êæ×Èâ çÐÇ ÈÇä×ÈÙ ÃêÖÇë Ùäé ÇÓÊÎÏÇå ÇäÔñÇåäÇÊ ÇäÂäêñÉ áê ÇäÓñäÇÓä ÇäæñÕêñÉ print "Hello $arr['fruit']"; print "Hello $_GET['foo']"; -// Concatenation is another option -print "Hello " . $arr['fruit']; // Hello apple +// ÇäÊñÊÇÈÙ (Concatenation) çè ÎêÇÑ ÂÎÑ +print "ÃçäÇ " . $arr['fruit']; // ÃçäÇ apple ?> ]]></programlisting> </informalexample> </para> <para> - When you turn <function>error_reporting</function> up to show - <constant>E_NOTICE</constant> level errors (such as setting - it to <constant>E_ALL</constant>) then you will see these - errors. By default, <link linkend="ini.error-reporting"> - error_reporting</link> is turned down to not show them. + ÙæÏåÇ Êâèå ÈÊáÙêä <function>error_reporting</function> äÅØçÇÑ + ÃÎ×ÇÁ åÓÊèé <constant>E_NOTICE</constant> (åËä Ãæ ÊÙêñæç + Èà <constant>E_ALL</constant>)¬ áÅæñã ÍêæçÇ ÓÊÑé çÐç + ÇäÃÎ×ÇÁ. ÈÔãä ÅáÊÑÇÖêñ¬ áÅæñ <link linkend="ini.error-reporting"> + error_reporting</link> çè åïÙ×ñîä ÈÚÑÖ ÙÏå ÅØçÇÑçÇ. </para> <para> - As stated in the <link linkend="language.types.array.syntax">syntax</link> section, - there must be an expression between the square brackets - ('<literal>[</literal>' and '<literal>]</literal>'). That means - that you can write things like this: + åËäåÇ ÊåÊ ÇäÅÔÇÑÉ Åäêç áê áÕä <link linkend="language.types.array.syntax">ÇäÕñêÚÉ</link> + áÅæñç êÌÈ Ãæ Êãèæ çæÇã ÙÈÇÑÉ Èêæ ÇäÃâèÇÓ ÇäåïÑîÈñîÙîÉ + ('<literal>[</literal>' è '<literal>]</literal>'). êÙæê çÐÇ + Ãæñç ÈÅåãÇæã ãÊÇÈÉ ÃÔêÇÁ åËä çÐç: <informalexample> <programlisting role="php"><![CDATA[ <?php @@ -1566,96 +1566,95 @@ ?> ]]></programlisting> </informalexample> - This is an example of using a function return value - as the array index. PHP also knows about constants, - as you may have seen the <literal>E_*</literal> ones - before. + êÙÊÈÑ çÐÇ åËäÇ Ùæ ÇÓÊÎÏÇå âêåÉ ÅÑÌÇÙ ÏÇäÉ + Ùäé Ôãä áçÑÓ åÕáèáÉ. ÃêÖǬ äÏé PHP ÏÑÇêÉ ÈÎÕèÕ ÇäËèÇÈÊ + åËäåÇ Ãåãæã äåÍç ÈÅäâÇÆã æØÑÉ Ùäé Êäã ÇäåÊÙäâÉ Èà <literal>E_*</literal> + áêåÇ ÓÈâ. <informalexample> <programlisting role="php"><![CDATA[ <?php -$error_descriptions[E_ERROR] = "A fatal error has occured"; -$error_descriptions[E_WARNING] = "PHP issued a warning"; -$error_descriptions[E_NOTICE] = "This is just an informal notice"; +$error_descriptions[E_ERROR] = "×Ñà Î×à áÇÏÍ"; +$error_descriptions[E_WARNING] = "ÃÕÏÑÊ PHP ÊÍÐêÑÇë"; +$error_descriptions[E_NOTICE] = "çÐÇ áâ× åÌÑÏ ÊæÈêç ÅÙäÇåêñ"; ?> ]]></programlisting> </informalexample> - Note that <literal>E_ERROR</literal> is also a valid identifier, - just like <literal>bar</literal> in the first example. But the last - example is in fact the same as writing: + ÅæÊÈç Åäé Ãæ <literal>E_ERROR</literal> çè ÃêÖÇ åïÙîÑñðá ÕÇäÍ + åËäåÇ ÇäÍÇä åÙ <literal>bar</literal> áê ÇäåËÇä ÇäÃèä. äãæ ÇäåËÇä ÇäÃÎêÑ + çè áê ÇäèÇâÙ æáÓ ÇäÔñêÁ åËä ãÊÇÈÉ: <informalexample> <programlisting role="php"><![CDATA[ <?php -$error_descriptions[1] = "A fatal error has occured"; -$error_descriptions[2] = "PHP issued a warning"; -$error_descriptions[8] = "This is just an informal notice"; +$error_descriptions[1] = "×Ñà Î×à áÇÏÍ"; +$error_descriptions[2] = "ÃÕÏÑÊ PHP ÊÍÐêÑÇë"; +$error_descriptions[8] = "çÐÇ áâ× åÌÑÏ ÊæÈêç ÅÙäÇåêñ"; ?> ]]></programlisting> </informalexample> - because <literal>E_ERROR</literal> equals <literal>1</literal>, etc. + äÃæ <literal>E_ERROR</literal> ÊÓÇèê <literal>1</literal>¬ ÅäÎ. </para> <para> - As we already explained in the above examples, - <literal>$foo[bar]</literal> still works but is wrong. - It works, because <literal>bar</literal> is due to its syntax - expected to be a constant expression. However, in this case no - constant with the name <literal>bar</literal> exists. PHP now - assumes that you meant <literal>bar</literal> literally, - as the string <literal>"bar"</literal>, but that you forgot - to write the quotes. + åËäåÇ ÔÑÍæÇç åÓÈâÇ áê ÇäÃåËäÉ ÇäÙäèêñɬ + áÅæñ <literal>$foo[bar]</literal> äÇ ÒÇä êÙåä äãæç ÎÇׯ. + çè êÙåä äÃæñ <literal>bar</literal>¬ èæØÑÇ äÕêÚÊç¬ + êïÊèâÙ åæç Ãæ êãèæ ÙÈÇÑÉë ËÇÈÊÉë. åÙ Ðä㬠áê çÐç ÇäÍÇäÉ äÇ êèÌÏ + Ãê ËÇÈÊ êÍåä ÅÓå <literal>bar</literal>. ÇäÂæ¬ ÓÊáÊÑÖ PHP + Ãæñã ãæÊ ÊâÕÏ <literal>bar</literal> ÍÑáêÇë¬ + Ùäé Ôãä ÇäÓñäÓäÉ ÇäæñÕêñÉ <literal>"bar"</literal> ÅäÇ Ãæñã æÓêÊ + ãÊÇÈÉ ÙäÇåÇÊ ÇäÊñæÕêÕ. </para> <sect4> - <title>So why is it bad then?</title> + <title>ÅÐæ äåÇÐÇ Ðäã ÓêÁ¿</title> <para> - At some point in the future, the PHP team might want to add another - constant or keyword, or you may introduce another constant into your - application, and then you get in trouble. For example, - you already cannot use the words <literal>empty</literal> and - <literal>default</literal> this way, since they are special - <link linkend="reserved">reserved keywords</link>. + ÙæÏ æáÓ Çäæñâ×É èáê ÇäåÓÊâÈä¬ áÅæñ áÑêâ PHP ÑÈåÇ êèñÏ ÅÖÇáÉ ËÇÈÊ + Ãè åáÊÇÍ ÂÎѬ Ãè ÑÈåÇ ÊèñÏ ÇäÊñåçêÏ äËÇÈÊ ÂÎÑ Öåæ + Ê×Èêâã èÍêæçÇ ÓÊãèæ áê èÑ×É. Ùäé ÓÈêä ÇäåËÇä¬ + äÇ êåãæã åÓÈâÇ ÇÓÊÎÏÇå ÇäãäåÇÊ <literal>empty</literal> è + <literal>default</literal> ÈçÐç Çä×ñÑêâÉ ÈÇÙÊÈÇÑ ÃæñçÇ + <link linkend="reserved">ãäåÇÊ åáÊÇÍêñÉ åÍÌèÒÉ</link> ÎÇÕÉ. </para> <note> <simpara> - To reiterate, inside a double-quoted <type>string</type>, it's - valid to not surround array indexes with quotes so - <literal>"$foo[bar]"</literal> is valid. See the above - examples for details on why as well as the section on - <link linkend="language.types.string.parsing">variable parsing - in strings</link>. + ääÅäÍÇͬ áÅæñç ÏÇÎä <type>string</type>¬ ÇäåÍÇ×É ÈÙäÇåÊê ÊæÕêÕ åÒÏèÌɬ åæ + ÇäÃÕäÍ ÙÏå ÅÍÇ×É áçÇÑÓ ÇäåÕáèáÉ ÈÙäÇåÇÊ ÊæÕêÕ ÈÍêË Ãæ + <literal>"$foo[bar]"</literal> ÊÙÊÈÑ ÕÇäÍÉ. ÊîåîÙñîæ áê ÇäÃåËäÉ + ÇäÙäèêñÉ ääÍÕèä Ùäé ÊáÇÕêä áêåÇ êÊÙäâ ÈÇäÓñÈÈ èãÐäã áê ÇäáÕä ÇäÎÇÕ Èà + <link linkend="language.types.string.parsing">ÊáÓêÑ ÇäåÊÚêÑÇÊ + áê ÇäÓñäÇÓä ÇäæñÕêñÉ</link>. </simpara> </note> </sect4> </sect3> </sect2> <sect2 id="language.types.array.casting"> - <title>Converting to array</title> + <title>ÇäÊÍèêä Åäé åÕáèáÉ</title> <para> - For any of the types: <type>integer</type>, <type>float</type>, - <type>string</type>, <type>boolean</type> and <type>resource</type>, - if you convert a value to an <type>array</type>, you get an array - with one element (with index 0), which is the scalar value you - started with. + äãäñ åæ ÇäÃæèÇÙ: <type>integer</type>¬ <type>float</type>¬ + <type>string</type>¬ <type>boolean</type> è <type>resource</type>¬ + ÅÐÇ ÍèñîäÊ âêåÉ Åäé <type>array</type> áÅæñã ÊÍÕä Ùäé åÕáèáÉ + ÐÇÊ ÙæÕÑ èÇÍÏ (åÙ ÇäáçÑÓ 0) èçê ÇäâêåÉ ÇäÃÍÇÏêñÉ ÇäÊê + ÈÏÃÊ ÈçÇ. </para> <para> - If you convert an <type>object</type> to an array, you get the - properties (member variables) of that object as the array's elements. - The keys are the member variable names. + ÅÐÇ ÍèñîäÊ <type>object</type> Åäé åÕáèáɬ áÅæñã ÊÍÕä + Ùäé ÎÕÇÆÕ (åÊÚêÑÇÊ ÙÖèêñÉ) Ðäã ÇäãÇÆæ Ùäé ÃæñçÇ ÙæÇÕÑ ÇäåÕáèáÉ. + ÇäåáÇÊêÍ çê ÃÓåÇÁ ÇäåÊÚêÑÇÊ ÇäÙÖèêñÉ. </para> <para> - If you convert a &null; value to an array, you get an empty array. + ÅÐÇ ÍèñîäÊ âêåÉ &null; Åäé åÕáèáɬ áÅæñã ÊÍÕä Ùäé åÕáèáÉ áÇÑÚÉ. </para> </sect2> <sect2 id="language.types.array.examples"> - <title>Examples</title> + <title>ÃåËäÉ</title> <para> - The array type in PHP is very versatile, so here will be some - examples to show you the full power of arrays. + êÓÊå æèÙ ÇäåÕáèáÉ áê PHP Èãèæç ÌÏ åÊâäñðÈ èÊèÌÏ çæÇ ÈÙÖ + ÇäÃåËäÉ äÊïØçÑ äã Çä×ÇâÉ ÇäãÇåäÉ ÇäÎÇÕÉ ÈÇäåÕáèáÇÊ. </para> <para> <informalexample> <programlisting role="php"><![CDATA[ <?php - // this $a = array( 'color' => 'red', 'taste' => 'sweet', @@ -1664,7 +1663,7 @@ 4 // key will be 0 ); -// is completely equivalent with +// êÊÔÇÈç ÊåÇåÇ åÙ $a['color'] = 'red'; $a['taste'] = 'sweet'; $a['shape'] = 'round'; @@ -1674,43 +1673,43 @@ $b[] = 'a'; $b[] = 'b'; $b[] = 'c'; -// will result in the array array(0 => 'a' , 1 => 'b' , 2 => 'c'), -// or simply array('a', 'b', 'c') +// ÓÊæÊÌ Ùæç ÇäåÕáèáÉ array(0 => 'a' , 1 => 'b' , 2 => 'c'), +// Ãè ÈÈÓÇ×É array('a', 'b', 'c') ?> ]]></programlisting> </informalexample> </para> <example> - <title>Using array()</title> + <title>ÅÓÊÎÏÇå array()</title> <programlisting role="php"><![CDATA[ <?php -// Array as (property-)map +// ÇäåÕáèáÉ Ùäé Ôãä (property-)map $map = array( 'version' => 4, 'OS' => 'Linux', - 'lang' => 'english', + 'lang' => 'arabic', 'short_tags' => true ); -// strictly numerical keys +// åáÇÊêÍ ÑâåêñÉ Ùäé èÌç ÇäÊñÏâêâ $array = array( 7, 8, 0, 156, -10 ); -// this is the same as array(0 => 7, 1 => 8, ...) +// èçÐÇ æáÓ ÇäÔñêÁ åËä array(0 => 7, 1 => 8, ...) $switching = array( 10, // key = 0 5 => 6, 3 => 7, 'a' => 4, - 11, // key = 6 (maximum of integer-indices was 5) - '8' => 2, // key = 8 (integer!) - '02' => 77, // key = '02' - 0 => 12 // the value 10 will be overwritten by 12 + 11, // ÇäåáÊÇÍ = 6 (ÇäÍÏ ÇäÃâÕé äáçÇÑÓ ÇäÃÙÏÇÏ ÇäÕñÍêÍÉ ãÇæÊ 5) + '8' => 2, // ÇäåáÊÇÍ = 8 (ÙÏÏ ÕÍêÍ!) + '02' => 77, // ÇäåáÊÇÍ = '02' + 0 => 12 // ÇäâêåÉ 10 ÓÊïÓÍâ åæ ×Ñá 12 ); -// empty array +// åÕáèáÉ áÇÑÚÉ $empty = array(); ?> ]]><!-- TODO example of @@ -1721,48 +1720,48 @@ </programlisting> </example> <example id="language.types.array.examples.loop"> - <title>Collection</title> + <title>ÇäÊñÔãêäÉ</title> <programlisting role="php"><![CDATA[ <?php -$colors = array('red', 'blue', 'green', 'yellow'); +$colors = array('ÃÍåÑ', 'ÃÒÑâ', 'ÃÎÖÑ', 'ÃÕáÑ'); foreach ($colors as $color) { - echo "Do you like $color?\n"; + echo "çä ÊÍÈ åÇ äèæç $color?\n"; } -/* output: -Do you like red? -Do you like blue? -Do you like green? -Do you like yellow? +/* ÇäåïÎÑÌ: +çä ÊÍÈ åÇ äèæç ÃÍåÑ¿ +çä ÊÍÈ åÇ äèæç ÃÒÑâ¿ +çä ÊÍÈ åÇ äèæç ÃÎÖÑ¿ +çä ÊÍÈ åÇ äèæç ÃÕáÑ¿ */ ?> ]]></programlisting> </example> <para> - Note that it is currently not possible to change the values of the array - directly in such a loop. + äÇÍØ Ãæç áê ÇäèâÊ ÇäÍÇäê äêÓ åæ Çäååãæ ÊÚêêÑ âêå ÇäåÕáèáÉ + åÈÇÔÑÉ áê åËä çÐç ÇäÍäâÉ. <!-- Should be made possible, if you write: foreach ( $colors as &$color ) See bug#3074 --> - A workaround is the following: + çæÇã Íä ÈÏêä èêÊåËä áê ÇäÊñÇäê: <example id="language.types.array.examples.changeloop"> - <title>Collection</title> + <title>ÇäÊñÔãêäÉ</title> <programlisting role="php"><![CDATA[ <?php foreach ($colors as $key => $color) { - // won't work: + // äæ êÙåä: //$color = strtoupper($color); - // works: + // êÙåä: $colors[$key] = strtoupper($color); } print_r($colors); -/* output: +/* ÇäåïÎÑÌ: Array ( [0] => RED @@ -1776,15 +1775,15 @@ </example> </para> <para> - This example creates a one-based array. + çÐÇ ÇäåËÇä êæÔÆ åÕáèáÉ ÃÍÇÏêñÉ ÇäâðèÇå. <example> - <title>One-based index</title> + <title>áçÑÓ ÃÍÇÏêñ ÇäâðèÇå</title> <programlisting role="php"><![CDATA[ <?php $firstquarter = array(1 => 'January', 'February', 'March'); print_r($firstquarter); -/* output: +/* ÇäåïÎÑÌ: Array ( [1] => 'January' @@ -1796,9 +1795,9 @@ </example> </para> <example> - <title>Filling an array</title> + <title>åäÁ åÕáèáÉ</title> <programlisting role="php"><![CDATA[ -// fill an array with all items from a directory +// Ååäà åÕáèáÉ ÈãÇáÉ ÇäÈæèÏ Åæ×äÇâÇ åæ åÌäÏ $handle = opendir('.'); while (false !== ($file = readdir($handle))) { $files[] = $file; @@ -1808,14 +1807,14 @@ ]]></programlisting> </example> <para> - Arrays are ordered. You can also change the order using various - sorting functions. See the <link linkend="ref.array">array - functions</link> section for more information. You can count - the number of items in an array using the - <function>count</function> function. + ÇäåÕáèáÇÊ åïÑñîÊÈÉ. êåãæã ÃêÖÇ ÊÚêêêÑ ÇäÊñÑÊêÈ ÈÇÓÊÎÏÇå + åÎÊäá ÏèÇä ÇäáÑÒ. äåÒêÏ åæ ÇäåÙäèåÇʬ ÊåÙñîæ áê åâ×Ù <link linkend="ref.array">ÏèÇä + ÇäåÕáèáÇÊ</link>. êåãæã ÍÓÇÈ + ÙÏÏ ÇäÈæèÏ áê åÕáèáÉ ÈÇÓÊÎÏÇå + ÏÇäÉ <function>count</function>. </para> <example> - <title>Sorting an array</title> + <title>áÑÒ åÕáèáÉ</title> <programlisting role="php"><![CDATA[ <?php sort($files); @@ -1824,12 +1823,12 @@ ]]></programlisting> </example> <para> - Because the value of an array can be anything, it can also be - another array. This way you can make recursive and - multi-dimensional arrays. + äÃæñ âêåÉ åÕáèáÉ êåãæ Ãæ Êãèæ Ãê ÔêÁ¬ áêåãæ Ãæ Êãèæ ÃêÖÇ + åÕáèáÉ ÃÎÑé. ÈçÐç Çä×ÑêâÉ êåãæã ÅÍÏÇË åÕáèáÇÊ åïÊîãîÑñðÑîÉ + èåïÊîÙîÏñðÏîÉ ÇäÃÈÙÇÏ. </para> <example> - <title>Recursive and multi-dimensional arrays</title> + <title>ÇäåÕáèáÇÊ ÇäåïÊîãîÑñðÑîÉ èÇäåïÊîÙîÏñðÏîÉ ÇäÃÈÙÇÏ</title> <programlisting role="php"><![CDATA[ <?php $fruits = array ( "fruits" => array ( "a" => "orange", @@ -1849,30 +1848,30 @@ ) ); -// Some examples to address values in the array above -echo $fruits["holes"][5]; // prints "second" -echo $fruits["fruits"]["a"]; // prints "orange" -unset($fruits["holes"][0]); // remove "first" +// ÈÙÖ ÇäÃåËäÉ Ùæ ÊèÌêç Çäâêå áê ÇäåÕáèáÉ ÇäÊê ÈÇäÃÙäé +echo $fruits["holes"][5]; // ê×ÈÙ "second" +echo $fruits["fruits"]["a"]; // ê×ÈÙ "orange" +unset($fruits["holes"][0]); // êÒêä "first" -// Create a new multi-dimensional array +// êæÔÆ åÕáèáÉ ÌÏêÏÉ åÊÙÏÏÉ ÇäÃÈÙÇÏ $juices["apple"]["green"] = "good"; ?> ]]></programlisting> </example> <para> - You should be aware that array assignment always involves - value copying. You need to use the reference operator to copy - an array by reference. + êÌÈ Ãæ ÊÏÑã Ãæ ÊÙêêæ åÕáèáÉ êâÊÖê ÏèåÇ + æÓÎ Çäâêå. ÊÍÊÇÌ äÇÓÊÎÏÇå åïÔîÚñðä åÑÌÙêñ äæÓÎ + åÕáèáÉ ÈÔãä åÑÌÙêñ. <informalexample> <programlisting role="php"><![CDATA[ <?php $arr1 = array(2, 3); $arr2 = $arr1; -$arr2[] = 4; // $arr2 is changed, - // $arr1 is still array(2, 3) +$arr2[] = 4; // $arr2 ÚïêñðÑî + // $arr1 äÇ ÒÇä array(2, 3) $arr3 = &$arr1; -$arr3[] = 4; // now $arr1 and $arr3 are the same +$arr3[] = 4; // ÇäÂæ $arr1 è $arr3 åÊÔÇÈçÇæ ?> ]]></programlisting> </informalexample> @@ -1880,12 +1879,12 @@ </sect2> </sect1> <sect1 id="language.types.object"> - <title>Objects</title> + <title>ÇäãÇÆæÇÊ</title> <sect2 id="language.types.object.init"> - <title>Object Initialization</title> + <title>ÅÓÊçäÇä ÇäãÇÆæÇÊ</title> <para> - To initialize an object, you use the <literal>new</literal> - statement to instantiate the object to a variable. + äÇÓÊçäÇä ãÇÆæ¬ ÇÓÊÎÏå ÈäÇÚ <literal>new</literal> + äÃÌä ÅæÔÇÁ åËêä ÇäãÇÆæ åæ ÃÌä åÊÚêÑ. <informalexample> <programlisting role="php"><![CDATA[ @@ -1905,11 +1904,11 @@ </informalexample> </para> <simpara> - For a full discussion, please read the section <link linkend="language.oop">Classes and Objects</link>. + åæ ÃÌä æâÇÔ èÇÓÙ¬ ÑÌÇÁë ÅâÑà áÕä <link linkend="language.oop">ÇäáÆÇÊ èÇäãÇÆæÇÊ</link>. </simpara> </sect2> <sect2 id="language.types.object.casting"> - <title>Converting to object</title> + <title>ÇäÊñÍèêä Åäé ãÇÆæ</title> <para> If an object is converted to an object, it is not modified. If a value of any other type is converted to an object, a new instance of the
« previous php.doc.ar (#573) next »