cvs: phpdoc /kr/language types.xml
| From: | Jaeyoung Cho | Date: | Thu, 01 Feb 2001 01:27:00 +0000 |
| Subject: | cvs: phpdoc /kr/language types.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969334087@lists.php.net to get a copy of this message | ||
pandach Wed Jan 31 17:27:00 2001 EDT
Modified files:
/phpdoc/kr/language types.xml
Log:
Index: phpdoc/kr/language/types.xml diff -u phpdoc/kr/language/types.xml:1.1 phpdoc/kr/language/types.xml:1.2 --- phpdoc/kr/language/types.xml:1.1 Mon Jan 8 22:04:51 2001 +++ phpdoc/kr/language/types.xml Wed Jan 31 17:27:00 2001 @@ -1,7 +1,8 @@ +<!-- edited with XML Spy v3.0.7 NT (http://www.xmlspy.com) by panda (bra) --> <chapter id="language.types"> <title>ë³ì íí (Types)</title> <para> - PHPë ë¤ì ííì typeì ì§ìíë¤. : + PHPë ë¤ìê³¼ ê°ì ë³ìíì ì§ìíë¤. : <itemizedlist> <listitem> <simpara> @@ -49,13 +50,13 @@ ì ìíì ë¤ìê³¼ ê°ì ííì ëª ë ¹ì¼ë¡ ì§ì í ì ìë¤. <informalexample> <programlisting role="php"> -$a = 1234; # decimal number -$a = -123; # a negative number -$a = 0123; # octal number (equivalent to 83 decimal) -$a = 0x12; # hexadecimal number (equivalent to 18 decimal) +$a = 1234; # ìì§ì +$a = -123; # ìì +$a = 0123; # 8ì§ì (ìì§ì 83ê³¼ ê°ì) +$a = 0x12; # 16ì§ì (ìì§ì 18ê³¼ ê°ì) </programlisting> </informalexample> - ì ìì í¬ê¸°ë ì¤ííê²½ìë°ë¼ ë¤ë¥´ë¤.(platform-dependent) + ì ìì í¬ê¸°ë ì¤ííê²½ìë°ë¼ ë¤ë¥´ë¤(platform-dependent). ë³´íµ ìµëê°ì´ ì½ 20ìµ(32 bits signed)ì¸ ê²½ì°ê° ë§ë¤. </para> </sect1> @@ -83,12 +84,12 @@ really being something like <literal>7.9999999999...</literal>. </para> <para> - This is related to the fact that it is impossible to exactly - express some fractions in decimal notation with a finite number - of digits. For instance, <literal>1/3</literal> in decimal form - becomes <literal>0.3333333. . .</literal>. + ì´ë ì íí ìì§ìë¡ ë¶ì를 ì ííê² ííí기 ë¶ê°ë íë¤ë ê²ê³¼ ì¼ë§¥ìíµíë¤. + ì를 ë¤ìë©´ ë¶ì +<literal>1/3</literal> ì ìì§ìë¡ íííìë©´ +<literal>0.3333333. . .</literal>ì´ ëë¤. </para> - <para> + <para> So never trust floating number results to the last digit and never compare floating point numbers for equality. If you really need higher precision, you should use the <link linkend="ref.bc">arbitrary precision math functions</link> @@ -102,7 +103,7 @@ 문ìì´ì ë ê°ì delimiters를 ì¬ì©í´ ëíë¸ë¤. </para> <para> - 문ìì´ì í° ë°ì´í(")ë¡ ëë¬ ì¸ê² ëë©´, í¹ì 문ìë¤ì ë¤ìê³¼ ê°ì´ íìíì¬ í¬í¨ìí¨ë¤. + 문ìì´ì í° ë°ì´í(")ë¡ ëë¬ ì¸ê² ëë©°, í¹ì 문ìë¤ì ë¤ìê³¼ ê°ì´ íìíì¬ í¬í¨ìí¨ë¤. Cë Perlììì²ë¼ ë°±ì¬ëì(\)를 ì¬ì©íì¬ í¹ì 기í¸ë¥¼ íìíê² ëë¤. <table> <title>Escaped characters</title> @@ -190,13 +191,13 @@ ì문ìì ì«ì, ë°ì¤(_)ë§ì ì¬ì©íì¬ì¼ íê³ , 첫ê¸ìë¡ ì«ìë ìëë¤. </simpara> <para> - Here doc 문ìì´ì í°ë°ì´í를 ì ì¸íê³ ë í°ë°ì´íë¡ ë¬¶ì¸ ë¬¸ìì´ê³¼ ëì¼íê² ì·¨ê¸ëë¤. + Here doc 문ìì´ì ë«ë í°ë°ì´í를 ì¬ì©íì§ ìê³ ì¬ë í°ë°ì´íë¡ë§ ë¬¶ì¸ ë¬¸ìì´ê³¼ ëì¼íê² ì·¨ê¸ëë¤. ì´ê²ì Here doc 문ìì´ë´ììë í°ë°ì´í를 escape í íìê° ìê³ , ìì ì í ë¤ë¥¸ escape ì½ëë ì¬ì©í ì ìë¤ë ê²ì ì미íë¤. 문ìì´ë´ì ë³ì를 ì¬ì©íì¬ ê·¸ ë³ìì ë´ì©ì 문ìì´ì ì½ì íë 기ë¥ì ì¬ì©í ì ìì§ë§, ë³ìê° ë¤ì´ê°ë ìì´ ë³µì¡í ê²½ì° ì£¼ìí´ì ì¬ì©íì. <example> - <title>Here doc string quoting example</title> + <title>doc string ìì </title> <programlisting> <?php $str = <<<EOD @@ -205,7 +206,7 @@ using heredoc syntax. EOD; -/* More complex example, with variables. */ +/* ë³ìë ì¬ì©ë ì¢ë ë³µì¡í ìì . */ class foo { var $foo; var $bar; @@ -236,7 +237,7 @@ <para> 문ìì´ì '.' (ì ) ì°ì°ìë¡ ì°ê²°í ì ìë¤. '+' (ëí기) ì°ì°ìë ì¬ì©í ì ìë¤. - ìì¸í ì ë³´ë <link linkend="language.operators.string">String operators</link> ë¶ë¶ì 참조í기 ë°ëë¤. + ìì¸í ì ë³´ë <link linkend="language.operators.string">문ìì´ ì°ì°ì(String operators)</link> ë¶ë¶ì 참조í기 ë°ëë¤. </para> <para> 문ìì´ë´ì ê°ê°ì 문ìë, C ì¸ì´ììì 문ìì ë°°ì´ë¡ë 문ìì´ì²ë¼ @@ -244,31 +245,31 @@ </para> <para> <example> - <title>Some string examples</title> + <title>문ìì´ ìì </title> <programlisting role="php"> <?php -/* Assigning a string. */ +/* 문ìì´ì ëì íë¤. */ $str = "This is a string"; -/* Appending to it. */ +/* 문ìì´ ì¶ê°. */ $str = $str . " with some more text"; -/* Another way to append, includes an escaped newline. */ +/* newlineê¹ì§ í¬í¨í´ì 문ìì´ ì¶ê°íë ë¤ë¥¸ë°©ë². */ $str .= " and a newline at the end.\n"; /* This string will end up being '<p>Number: 9</p>' */ $num = 9; $str = "<p>Number: $num</p>"; -/* This one will be '<p>Number: $num</p>' */ +/* '<p>Number: $num</p>' ìì²´ê° ë¬¸ìì´ì´ ëë¤ */ $num = 9; $str = '<p>Number: $num</p>'; -/* Get the first character of a string */ +/* 문ìì´ì 첫ë²ì§¸ 문ì ì»ê¸° */ $str = 'This is a test.'; $first = $str[0]; -/* Get the last character of a string. */ +/* 문ìì´ì ë§ì§ë§ 문ì ì»ê¸°. */ $str = 'This is still a test.'; $last = $str[strlen($str)-1]; ?> @@ -294,14 +295,14 @@ </simpara> <informalexample> <programlisting role="php"> -$foo = 1 + "10.5"; // $foo is double (11.5) -$foo = 1 + "-1.3e3"; // $foo is double (-1299) -$foo = 1 + "bob-1.3e3"; // $foo is integer (1) -$foo = 1 + "bob3"; // $foo is integer (1) -$foo = 1 + "10 Small Pigs"; // $foo is integer (11) -$foo = 1 + "10 Little Piggies"; // $foo is integer (11) -$foo = "10.0 pigs " + 1; // $foo is integer (11) -$foo = "10.0 pigs " + 1.0; // $foo is double (11) +$foo = 1 + "10.5"; // $foo ë doubleí (11.5) +$foo = 1 + "-1.3e3"; // $foo ë doubleí (-1299) +$foo = 1 + "bob-1.3e3"; // $foo ë ì ìí (1) +$foo = 1 + "bob3"; // $foo ë ì ìí (1) +$foo = 1 + "10 Small Pigs"; // $foo ë ì ìí (11) +$foo = 1 + "10 Little Piggies"; // $foo ë ì ìí (11) +$foo = "10.0 pigs " + 1; // $foo ë ì ìí (11) +$foo = "10.0 pigs " + 1.0; // $foo ë doubleí (11) </programlisting> </informalexample> <simpara> @@ -356,10 +357,10 @@ <function>uksort</function> í¨ìë¤ì ì´ì©í´ ììëë¡ ì ë ¬í ì ìë¤. </para> <para> - <function>count</function> í¨ì를 ì¬ì©íë©´ ë°°ì´ì ìì ê°ì를 ì ì ìë¤. + <function>count</function> í¨ì를 ì¬ì©íë©´ ë°°ì´ì ìì ê°ì를 ì ì ìë¤. </para> <para> - <function>next</function>ì <function>prev</function>í¨ì를 ì´ì©íì¬ ë°°ì´ì ë´ì©ì íìí ì ìë¤. + <function>next</function>ì <function>prev</function>í¨ì를 ì´ì©íì¬ ë°°ì´ì ë´ì©ì íìí ì ìë¤. ë°°ì´ì ë´ì©ì íìíë ë°©ë²ì¼ë¡ <function>each</function>í¨ì를 ì¬ì©í ìë ìë¤. </para> </sect2> @@ -369,14 +370,14 @@ ë¤ì°¨ì ë°°ì´ë ì¤ì ë¡ ë§¤ì° ê°ë¨íë¤. ë°°ì´ì ê° ì°¨ìì ëíì¬ ë¨ì§ [key]ê°ì ë¤ì ë¶ì¬ì£¼ë©´ ëë¤.: <informalexample> <programlisting role="php"> -$a[1] = $f; # one dimensional examples +$a[1] = $f; # ì¼ì°¨ì ë°°ì´ì ìì $a["foo"] = $f; -$a[1][0] = $f; # two dimensional -$a["foo"][2] = $f; # (you can mix numeric and associative indices) -$a[3]["bar"] = $f; # (you can mix numeric and associative indices) +$a[1][0] = $f; # ì´ì°¨ì ë°°ì´ì ìì +$a["foo"][2] = $f; # (ë°°ì´ ì§ìì를 ì«ìì 문ìë¡ í¼í©í ì ìë¤) +$a[3]["bar"] = $f; # (ë°°ì´ ì§ìì를 ì«ìì 문ìë¡ í¼í©í ì ìë¤) -$a["foo"][4]["bar"][0] = $f; # four dimensional! +$a["foo"][4]["bar"][0] = $f; # 4ì°¨ìë°°ì´! </programlisting> </informalexample> </para> @@ -433,7 +434,7 @@ </informalexample> </para> <para> - <function>array</function> í¨ìë ë¤ì°¨ì ë°°ì´ì ëí´ìë ë¤ìê³¼ ê°ì´ ì¬ì©í ì ìë¤. : + <function>array</function> í¨ìë ë¤ì°¨ì ë°°ì´ì ëí´ìë ë¤ìê³¼ ê°ì´ ì¬ì©í ì ìë¤. : <informalexample> <programlisting role="php"> <?php @@ -489,49 +490,42 @@ </sect2> </sect1> <sect1 id="language.types.type-juggling"> - <title>Type ì í (Type juggling)</title> + <title>í ë¤ë£¨ê¸° (Type juggling)</title> <simpara> - PHP does not require (or support) explicit type definition in - variable declaration; a variable's type is determined by the - context in which that variable is used. That is to say, if you - assign a string value to variable <parameter>var</parameter>, - <parameter>var</parameter> becomes a string. If you then assign an - integer value to <parameter>var</parameter>, it becomes an - integer. - </simpara> - <para> - An example of PHP's automatic type conversion is the addition - operator '+'. If any of the operands is a double, then all - operands are evaluated as doubles, and the result will be a - double. Otherwise, the operands will be interpreted as integers, - and the result will also be an integer. Note that this does NOT - change the types of the operands themselves; the only change is in - how the operands are evaluated. + PHPììë ë³ìíì ëª ííê² ì ì¸í íìë ìê³ , ë³ìí ì ì¸ì´ + ì ê³µëì§ë ìëë¤. ë³ìì typeì 구문ë´ìì ì¬ì©ëì´ì§ë ê²°ì ëë¤. + ë¤ìë§í´ ë³ì<parameter>var</parameter>ì 문ìì´ì í ë¹(assign)íë©´, ë³ì + <parameter>var</parameter> ì íì 문ìì´ì´ ëê³ , ë³ì +<parameter>var</parameter>ì ì ì를 í ë¹(assign)íë©´ ì ìí ë³ìê° ëë¤ +</simpara> + <para> PHPì ìëíë³íì ëí ìë '+'ì°ì°ìì ëí ìíì ë³´ë©´ ìì ìë¤. + '+'ì°ì°ìê° ì¬ì©ë ì°ì°ìì¤ íëì í¼ì°ì°ìê° doubleíì´ë¼ë©´ ë¤ë¥¸ í¼ì°ì°ìë¤ë + doubleíì¼ë¡ ê³ì°ëì´ ê²°ê³¼ë doubleíì´ ëë¤. ë§ì°¬ê°ì§ë¡ íëì í¼ì°ì°ìê° + ì ìíì´ë¼ë©´ ê·¸ ê²°ê³¼ë ì ìíì´ ëë¤. ì¬ê¸°ì 주ìí´ì¼ í ê²ì íëì í¼ì°ìì ìí´ + ë¤ë¥¸ í¼ì°ì°ìì íì´ ë°ëë ê²ì´ ìëë¼ ë¨ì§ ê·¸ ê²°ê³¼ê°ìë§ ìí¥ì 미ì¹ë¤. <informalexample> <programlisting role="php"> -$foo = "0"; // $foo is string (ASCII 48) -$foo++; // $foo is the string "1" (ASCII 49) -$foo += 1; // $foo is now an integer (2) -$foo = $foo + 1.3; // $foo is now a double (3.3) -$foo = 5 + "10 Little Piggies"; // $foo is integer (15) -$foo = 5 + "10 Small Pigs"; // $foo is integer (15) +$foo = "0"; // $foo ë 문ìì´ ë³ì (ASCII 48) +$foo++; // $foo ë 문ìì´ ë³ì "1" (ASCII 49) +$foo += 1; // $foo ë ì ìí ë³ìë¡ ë³íëìë¤. (2) +$foo = $foo + 1.3; // $foo ë doubleí ë³ìë¡ ë³íëìë¤. (3.3) +$foo = 5 + "10 Little Piggies"; // $foo ë ì ìí ë³ì (15) +$foo = 5 + "10 Small Pigs"; // $foo ë ì ìí ë³ì (15) </programlisting> </informalexample> </para> - <simpara> - If the last two examples above seem odd, see <link linkend="language.types.string.conversion">String - conversion</link>. + <simpara> ìì ìë¤ ì¤ ë§ì§ë§ ë ìê° ì´í´ê° ëì§ ìëë¤ë©´ +<link linkend="language.types.string.conversion">문ìì´ ë³í(String + conversion)</link>ì 참조í기 ë°ëë¤. </simpara> - <simpara> - If you wish to force a variable to be evaluated as a certain type, - see the section on <link linkend="language.types.typecasting">Type - casting</link>. If you wish to change the type of a variable, see - <function>settype</function>. + <simpara> ë³ìê° í¹ì í í(type)ì¼ë¡ ê³ì°ëì´ì§ê² íê³ ìí ê²½ì° +<link linkend="language.types.typecasting">Type + casting</link>ì 참조íê³ , ë³ìì íì ë³íìì¹´ê³ ì í ê²½ì°ë + <function>settype</function>ì 참조í기 ë°ëë¤. </simpara> <para> - If you would like to test any of the examples in this section, you - can cut and paste the examples and insert the following line to - see for yourself what's going on: + ì´ ì¹ì ìì ìì 를 í ì¤í¸ í´ë³´ê³ ì íë¤ë©´, ìì 를 php fileì ë³µì¬íê³ + ìëì 문ì¥ì ì¨ì¤ë¤ë©´ ì´ë»ê² ë³ìíì´ ë³íëì§ íì¸í´ ë³¼ì ììê²ì´ë¤. <informalexample> <programlisting role="php"> echo "\$foo==$foo; type is " . gettype ($foo) . "<br>\n"; @@ -540,74 +534,68 @@ </para> <note> <para> - The behaviour of an automatic conversion to array is currently - undefined. + ë°°ì´ììì ìë íë³íì íµìì ì¼ë¡ ì ìëì´ì ¸ ìì§ ìë¤. <informalexample> <programlisting role="php"> -$a = 1; // $a is an integer -$a[0] = "f"; // $a becomes an array, with $a[0] holding "f" - </programlisting> +$a = 1; // $a ë ì ìíì´ë¤ +$a[0] = "f"; // $a ë $a[0]ê° "f"ì ê°ì ê°ì§ ë°°ì´ì´ë¤. </programlisting> </informalexample> </para> <para> - While the above example may seem like it should clearly result in - $a becoming an array, the first element of which is 'f', consider - this: + ìì ìë $aê° ì²«ë²ì§¸ ììë¡ 'f'를 ê°ì§ë ë°°ì´ë¡ íë³í ëëê² ëª ííê² ë³´ì´ì§ë§, + ìëì ê²½ì°ë¥¼ ìê°í´ ë³´ì <informalexample> <programlisting role="php"> -$a = "1"; // $a is a string -$a[0] = "f"; // What about string offsets? What happens? +$a = "1"; // $aë 문ìì´ì´ë¤ +$a[0] = "f"; // 첨ì 0ì´ ë¬¸ìì´ì ëí ì¤íì (offset)ì¸ê°? ì¬ê¸°ìë ì´ë¤ì¼ì´ ì¼ì´ë ê²ì¸ê°? </programlisting> </informalexample> </para> <para> - Since PHP supports indexing into strings via offsets using the - same syntax as array indexing, the example above leads to a - problem: should $a become an array with its first element being - "f", or should "f" become the first character of the string $a? + PHPìì ë°°ì´ì ì¸ë±ì¤(index)ì ê°ì ì¤íì (offset)ì ì´ì©í ì¸ë±ì¤(index)를 + 문ìì´ ë³ììë ì¬ì©í ì ìë¤. ë°ë¼ì ìì ìë ë¤ìê³¼ ê°ì 문ì 를 ìê³ ìë¤.: + $aê° ì²«ë²ì§¸ ììê° "f"ì¸ ë°°ì´ì¸ê°? + "f"ê° ë¬¸ìì´ ë³ì $aì 첫ë²ì§¸ 문ìê° ëì´ì¼ íëê°? </para> <para> - For this reason, as of PHP 3.0.12 and PHP 4.0b3-RC4, the result - of this automatic conversion is considered to be undefined. Fixes - are, however, being discussed. + ì´ë¬í ì´ì ë¡, PHP 3.0.12 and PHP 4.0b3-RC4ìì ìì ê°ì ê²½ì°ì + ìë í ë³íì ì ìëì´ ìì§ ìë¤ê³ íë¤. ì´ì ëí ì íí ì ìë ë ¼ì ëì´ ì§ê²ì´ë¤. </para> </note> <sect2 id="language.types.typecasting"> - <title>Type Casting</title> + <title>í ì ì©(Type Casting)</title> <para> - Type casting in PHP works much as it does in C: the name of the - desired type is written in parentheses before the variable which - is to be cast. + PHPìì íì ì©(type casting)ì C languageììì ë§¤ì° ì ì¬íë¤. + ìíë íì ì ì ì©(casting)ëì´ì§ë ë³ììì ê´í¸ë¡ 묶ì´ì ì¨ ì£¼ê¸°ë§ íë©´ ëë¤. <informalexample> <programlisting role="php"> -$foo = 10; // $foo is an integer -$bar = (double) $foo; // $bar is a double +$foo = 10; // $fooë ì ìíì´ë¤. +$bar = (double) $foo; // $barë type castingì¼ë¡ doubleíì´ë¤ </programlisting> </informalexample> </para> <para> - The casts allowed are: + ìëì ê°ì ê²½ì°ë¥¼ ì ì©í ì ìë¤: <itemizedlist> <listitem> - <simpara>(int), (integer) - cast to integer</simpara> + <simpara>(int), (integer) - ì ìë¡ cast</simpara> </listitem> <listitem> - <simpara>(real), (double), (float) - cast to double</simpara> + <simpara>(real), (double), (float) - doubleíì¼ë¡ cast</simpara> </listitem> <listitem> - <simpara>(string) - cast to string</simpara> + <simpara>(string) - 문ìì´ë¡ cast</simpara> </listitem> <listitem> - <simpara>(array) - cast to array</simpara> + <simpara>(array) - ë°°ì´ë¡ cast</simpara> </listitem> <listitem> - <simpara>(object) - cast to object</simpara> + <simpara>(object) - ê°ì²´(object)ë¡ cast</simpara> </listitem> </itemizedlist> </para> <para> - Note that tabs and spaces are allowed inside the parentheses, so - the following are functionally equivalent: + ê´í¸ìì tabì´ë 공백문ìë íì©ëë¯ë¡ ìëì ë 문ì¥ì ê°ì´ ì·¨ê¸ëë¤. <informalexample> <programlisting role="php"> $foo = (int) $bar; @@ -616,30 +604,28 @@ </informalexample> </para> <para> - It may not be obvious exactly what will happen when casting - between certain types. For instance, the following should be - noted. + í¹ì í íì ì¼ë¡ castingë ëì ê²°ê³¼ë ëª ííì§ ìë¤. + ì를 ë¤ì´ ë¤ìê³¼ ê°ì ê²½ì° ì£¼ì를 ìíë¤. </para> <para> - When casting from a scalar or a string variable to an array, the - variable will become the first element of the array: + ì¤ì¹¼ë¼(scalar)ë³ìë 문ìì´ ë³ìê° ë°°ì´ë¡ castingë ë ê·¸ ë³ìë + ë°°ì´ì 첫ë²ì§¸ ììê° ëë¤. <informalexample> <programlisting role="php"> $var = 'ciao'; $arr = (array) $var; -echo $arr[0]; // outputs 'ciao' +echo $arr[0]; // ê²°ê³¼ê°ì 'ciao' ì´ ëë¤ </programlisting> </informalexample> </para> <para> - When casting from a scalar or a string variable to an object, the - variable will become an attribute of the object; the attribute - name will be 'scalar': + ì¤ì¹¼ë¼(scalar)ë³ìë 문ìì´ ë³ìê° ê°ì²´ë¡ castingë ë ê·¸ ë³ìë + 'scalar'ë¼ë ê°ì²´ì ìì±ê°ì´ ëë¤. <informalexample> <programlisting role="php"> $var = 'ciao'; $obj = (object) $var; -echo $obj->scalar; // outputs 'ciao' +echo $obj->scalar; // ê²°ê³¼ê°ì 'ciao' ì´ ëë¤ </programlisting> </informalexample> </para>
Index: phpdoc/kr/language/types.xml diff -u phpdoc/kr/language/types.xml:1.1 phpdoc/kr/language/types.xml:1.2 --- phpdoc/kr/language/types.xml:1.1 Mon Jan 8 22:04:51 2001 +++ phpdoc/kr/language/types.xml Wed Jan 31 17:27:00 2001 @@ -1,7 +1,8 @@ +<!-- edited with XML Spy v3.0.7 NT (http://www.xmlspy.com) by panda (bra) --> <chapter id="language.types"> <title>ë³ì íí (Types)</title> <para> - PHPë ë¤ì ííì typeì ì§ìíë¤. : + PHPë ë¤ìê³¼ ê°ì ë³ìíì ì§ìíë¤. : <itemizedlist> <listitem> <simpara> @@ -49,13 +50,13 @@ ì ìíì ë¤ìê³¼ ê°ì ííì ëª ë ¹ì¼ë¡ ì§ì í ì ìë¤. <informalexample> <programlisting role="php"> -$a = 1234; # decimal number -$a = -123; # a negative number -$a = 0123; # octal number (equivalent to 83 decimal) -$a = 0x12; # hexadecimal number (equivalent to 18 decimal) +$a = 1234; # ìì§ì +$a = -123; # ìì +$a = 0123; # 8ì§ì (ìì§ì 83ê³¼ ê°ì) +$a = 0x12; # 16ì§ì (ìì§ì 18ê³¼ ê°ì) </programlisting> </informalexample> - ì ìì í¬ê¸°ë ì¤ííê²½ìë°ë¼ ë¤ë¥´ë¤.(platform-dependent) + ì ìì í¬ê¸°ë ì¤ííê²½ìë°ë¼ ë¤ë¥´ë¤(platform-dependent). ë³´íµ ìµëê°ì´ ì½ 20ìµ(32 bits signed)ì¸ ê²½ì°ê° ë§ë¤. </para> </sect1> @@ -83,12 +84,12 @@ really being something like <literal>7.9999999999...</literal>. </para> <para> - This is related to the fact that it is impossible to exactly - express some fractions in decimal notation with a finite number - of digits. For instance, <literal>1/3</literal> in decimal form - becomes <literal>0.3333333. . .</literal>. + ì´ë ì íí ìì§ìë¡ ë¶ì를 ì ííê² ííí기 ë¶ê°ë íë¤ë ê²ê³¼ ì¼ë§¥ìíµíë¤. + ì를 ë¤ìë©´ ë¶ì +<literal>1/3</literal> ì ìì§ìë¡ íííìë©´ +<literal>0.3333333. . .</literal>ì´ ëë¤. </para> - <para> + <para> So never trust floating number results to the last digit and never compare floating point numbers for equality. If you really need higher precision, you should use the <link linkend="ref.bc">arbitrary precision math functions</link> @@ -102,7 +103,7 @@ 문ìì´ì ë ê°ì delimiters를 ì¬ì©í´ ëíë¸ë¤. </para> <para> - 문ìì´ì í° ë°ì´í(")ë¡ ëë¬ ì¸ê² ëë©´, í¹ì 문ìë¤ì ë¤ìê³¼ ê°ì´ íìíì¬ í¬í¨ìí¨ë¤. + 문ìì´ì í° ë°ì´í(")ë¡ ëë¬ ì¸ê² ëë©°, í¹ì 문ìë¤ì ë¤ìê³¼ ê°ì´ íìíì¬ í¬í¨ìí¨ë¤. Cë Perlììì²ë¼ ë°±ì¬ëì(\)를 ì¬ì©íì¬ í¹ì 기í¸ë¥¼ íìíê² ëë¤. <table> <title>Escaped characters</title> @@ -190,13 +191,13 @@ ì문ìì ì«ì, ë°ì¤(_)ë§ì ì¬ì©íì¬ì¼ íê³ , 첫ê¸ìë¡ ì«ìë ìëë¤. </simpara> <para> - Here doc 문ìì´ì í°ë°ì´í를 ì ì¸íê³ ë í°ë°ì´íë¡ ë¬¶ì¸ ë¬¸ìì´ê³¼ ëì¼íê² ì·¨ê¸ëë¤. + Here doc 문ìì´ì ë«ë í°ë°ì´í를 ì¬ì©íì§ ìê³ ì¬ë í°ë°ì´íë¡ë§ ë¬¶ì¸ ë¬¸ìì´ê³¼ ëì¼íê² ì·¨ê¸ëë¤. ì´ê²ì Here doc 문ìì´ë´ììë í°ë°ì´í를 escape í íìê° ìê³ , ìì ì í ë¤ë¥¸ escape ì½ëë ì¬ì©í ì ìë¤ë ê²ì ì미íë¤. 문ìì´ë´ì ë³ì를 ì¬ì©íì¬ ê·¸ ë³ìì ë´ì©ì 문ìì´ì ì½ì íë 기ë¥ì ì¬ì©í ì ìì§ë§, ë³ìê° ë¤ì´ê°ë ìì´ ë³µì¡í ê²½ì° ì£¼ìí´ì ì¬ì©íì. <example> - <title>Here doc string quoting example</title> + <title>doc string ìì </title> <programlisting> <?php $str = <<<EOD @@ -205,7 +206,7 @@ using heredoc syntax. EOD; -/* More complex example, with variables. */ +/* ë³ìë ì¬ì©ë ì¢ë ë³µì¡í ìì . */ class foo { var $foo; var $bar; @@ -236,7 +237,7 @@ <para> 문ìì´ì '.' (ì ) ì°ì°ìë¡ ì°ê²°í ì ìë¤. '+' (ëí기) ì°ì°ìë ì¬ì©í ì ìë¤. - ìì¸í ì ë³´ë <link linkend="language.operators.string">String operators</link> ë¶ë¶ì 참조í기 ë°ëë¤. + ìì¸í ì ë³´ë <link linkend="language.operators.string">문ìì´ ì°ì°ì(String operators)</link> ë¶ë¶ì 참조í기 ë°ëë¤. </para> <para> 문ìì´ë´ì ê°ê°ì 문ìë, C ì¸ì´ììì 문ìì ë°°ì´ë¡ë 문ìì´ì²ë¼ @@ -244,31 +245,31 @@ </para> <para> <example> - <title>Some string examples</title> + <title>문ìì´ ìì </title> <programlisting role="php"> <?php -/* Assigning a string. */ +/* 문ìì´ì ëì íë¤. */ $str = "This is a string"; -/* Appending to it. */ +/* 문ìì´ ì¶ê°. */ $str = $str . " with some more text"; -/* Another way to append, includes an escaped newline. */ +/* newlineê¹ì§ í¬í¨í´ì 문ìì´ ì¶ê°íë ë¤ë¥¸ë°©ë². */ $str .= " and a newline at the end.\n"; /* This string will end up being '<p>Number: 9</p>' */ $num = 9; $str = "<p>Number: $num</p>"; -/* This one will be '<p>Number: $num</p>' */ +/* '<p>Number: $num</p>' ìì²´ê° ë¬¸ìì´ì´ ëë¤ */ $num = 9; $str = '<p>Number: $num</p>'; -/* Get the first character of a string */ +/* 문ìì´ì 첫ë²ì§¸ 문ì ì»ê¸° */ $str = 'This is a test.'; $first = $str[0]; -/* Get the last character of a string. */ +/* 문ìì´ì ë§ì§ë§ 문ì ì»ê¸°. */ $str = 'This is still a test.'; $last = $str[strlen($str)-1]; ?> @@ -294,14 +295,14 @@ </simpara> <informalexample> <programlisting role="php"> -$foo = 1 + "10.5"; // $foo is double (11.5) -$foo = 1 + "-1.3e3"; // $foo is double (-1299) -$foo = 1 + "bob-1.3e3"; // $foo is integer (1) -$foo = 1 + "bob3"; // $foo is integer (1) -$foo = 1 + "10 Small Pigs"; // $foo is integer (11) -$foo = 1 + "10 Little Piggies"; // $foo is integer (11) -$foo = "10.0 pigs " + 1; // $foo is integer (11) -$foo = "10.0 pigs " + 1.0; // $foo is double (11) +$foo = 1 + "10.5"; // $foo ë doubleí (11.5) +$foo = 1 + "-1.3e3"; // $foo ë doubleí (-1299) +$foo = 1 + "bob-1.3e3"; // $foo ë ì ìí (1) +$foo = 1 + "bob3"; // $foo ë ì ìí (1) +$foo = 1 + "10 Small Pigs"; // $foo ë ì ìí (11) +$foo = 1 + "10 Little Piggies"; // $foo ë ì ìí (11) +$foo = "10.0 pigs " + 1; // $foo ë ì ìí (11) +$foo = "10.0 pigs " + 1.0; // $foo ë doubleí (11) </programlisting> </informalexample> <simpara> @@ -356,10 +357,10 @@ <function>uksort</function> í¨ìë¤ì ì´ì©í´ ììëë¡ ì ë ¬í ì ìë¤. </para> <para> - <function>count</function> í¨ì를 ì¬ì©íë©´ ë°°ì´ì ìì ê°ì를 ì ì ìë¤. + <function>count</function> í¨ì를 ì¬ì©íë©´ ë°°ì´ì ìì ê°ì를 ì ì ìë¤. </para> <para> - <function>next</function>ì <function>prev</function>í¨ì를 ì´ì©íì¬ ë°°ì´ì ë´ì©ì íìí ì ìë¤. + <function>next</function>ì <function>prev</function>í¨ì를 ì´ì©íì¬ ë°°ì´ì ë´ì©ì íìí ì ìë¤. ë°°ì´ì ë´ì©ì íìíë ë°©ë²ì¼ë¡ <function>each</function>í¨ì를 ì¬ì©í ìë ìë¤. </para> </sect2> @@ -369,14 +370,14 @@ ë¤ì°¨ì ë°°ì´ë ì¤ì ë¡ ë§¤ì° ê°ë¨íë¤. ë°°ì´ì ê° ì°¨ìì ëíì¬ ë¨ì§ [key]ê°ì ë¤ì ë¶ì¬ì£¼ë©´ ëë¤.: <informalexample> <programlisting role="php"> -$a[1] = $f; # one dimensional examples +$a[1] = $f; # ì¼ì°¨ì ë°°ì´ì ìì $a["foo"] = $f; -$a[1][0] = $f; # two dimensional -$a["foo"][2] = $f; # (you can mix numeric and associative indices) -$a[3]["bar"] = $f; # (you can mix numeric and associative indices) +$a[1][0] = $f; # ì´ì°¨ì ë°°ì´ì ìì +$a["foo"][2] = $f; # (ë°°ì´ ì§ìì를 ì«ìì 문ìë¡ í¼í©í ì ìë¤) +$a[3]["bar"] = $f; # (ë°°ì´ ì§ìì를 ì«ìì 문ìë¡ í¼í©í ì ìë¤) -$a["foo"][4]["bar"][0] = $f; # four dimensional! +$a["foo"][4]["bar"][0] = $f; # 4ì°¨ìë°°ì´! </programlisting> </informalexample> </para> @@ -433,7 +434,7 @@ </informalexample> </para> <para> - <function>array</function> í¨ìë ë¤ì°¨ì ë°°ì´ì ëí´ìë ë¤ìê³¼ ê°ì´ ì¬ì©í ì ìë¤. : + <function>array</function> í¨ìë ë¤ì°¨ì ë°°ì´ì ëí´ìë ë¤ìê³¼ ê°ì´ ì¬ì©í ì ìë¤. : <informalexample> <programlisting role="php"> <?php @@ -489,49 +490,42 @@ </sect2> </sect1> <sect1 id="language.types.type-juggling"> - <title>Type ì í (Type juggling)</title> + <title>í ë¤ë£¨ê¸° (Type juggling)</title> <simpara> - PHP does not require (or support) explicit type definition in - variable declaration; a variable's type is determined by the - context in which that variable is used. That is to say, if you - assign a string value to variable <parameter>var</parameter>, - <parameter>var</parameter> becomes a string. If you then assign an - integer value to <parameter>var</parameter>, it becomes an - integer. - </simpara> - <para> - An example of PHP's automatic type conversion is the addition - operator '+'. If any of the operands is a double, then all - operands are evaluated as doubles, and the result will be a - double. Otherwise, the operands will be interpreted as integers, - and the result will also be an integer. Note that this does NOT - change the types of the operands themselves; the only change is in - how the operands are evaluated. + PHPììë ë³ìíì ëª ííê² ì ì¸í íìë ìê³ , ë³ìí ì ì¸ì´ + ì ê³µëì§ë ìëë¤. ë³ìì typeì 구문ë´ìì ì¬ì©ëì´ì§ë ê²°ì ëë¤. + ë¤ìë§í´ ë³ì<parameter>var</parameter>ì 문ìì´ì í ë¹(assign)íë©´, ë³ì + <parameter>var</parameter> ì íì 문ìì´ì´ ëê³ , ë³ì +<parameter>var</parameter>ì ì ì를 í ë¹(assign)íë©´ ì ìí ë³ìê° ëë¤ +</simpara> + <para> PHPì ìëíë³íì ëí ìë '+'ì°ì°ìì ëí ìíì ë³´ë©´ ìì ìë¤. + '+'ì°ì°ìê° ì¬ì©ë ì°ì°ìì¤ íëì í¼ì°ì°ìê° doubleíì´ë¼ë©´ ë¤ë¥¸ í¼ì°ì°ìë¤ë + doubleíì¼ë¡ ê³ì°ëì´ ê²°ê³¼ë doubleíì´ ëë¤. ë§ì°¬ê°ì§ë¡ íëì í¼ì°ì°ìê° + ì ìíì´ë¼ë©´ ê·¸ ê²°ê³¼ë ì ìíì´ ëë¤. ì¬ê¸°ì 주ìí´ì¼ í ê²ì íëì í¼ì°ìì ìí´ + ë¤ë¥¸ í¼ì°ì°ìì íì´ ë°ëë ê²ì´ ìëë¼ ë¨ì§ ê·¸ ê²°ê³¼ê°ìë§ ìí¥ì 미ì¹ë¤. <informalexample> <programlisting role="php"> -$foo = "0"; // $foo is string (ASCII 48) -$foo++; // $foo is the string "1" (ASCII 49) -$foo += 1; // $foo is now an integer (2) -$foo = $foo + 1.3; // $foo is now a double (3.3) -$foo = 5 + "10 Little Piggies"; // $foo is integer (15) -$foo = 5 + "10 Small Pigs"; // $foo is integer (15) +$foo = "0"; // $foo ë 문ìì´ ë³ì (ASCII 48) +$foo++; // $foo ë 문ìì´ ë³ì "1" (ASCII 49) +$foo += 1; // $foo ë ì ìí ë³ìë¡ ë³íëìë¤. (2) +$foo = $foo + 1.3; // $foo ë doubleí ë³ìë¡ ë³íëìë¤. (3.3) +$foo = 5 + "10 Little Piggies"; // $foo ë ì ìí ë³ì (15) +$foo = 5 + "10 Small Pigs"; // $foo ë ì ìí ë³ì (15) </programlisting> </informalexample> </para> - <simpara> - If the last two examples above seem odd, see <link linkend="language.types.string.conversion">String - conversion</link>. + <simpara> ìì ìë¤ ì¤ ë§ì§ë§ ë ìê° ì´í´ê° ëì§ ìëë¤ë©´ +<link linkend="language.types.string.conversion">문ìì´ ë³í(String + conversion)</link>ì 참조í기 ë°ëë¤. </simpara> - <simpara> - If you wish to force a variable to be evaluated as a certain type, - see the section on <link linkend="language.types.typecasting">Type - casting</link>. If you wish to change the type of a variable, see - <function>settype</function>. + <simpara> ë³ìê° í¹ì í í(type)ì¼ë¡ ê³ì°ëì´ì§ê² íê³ ìí ê²½ì° +<link linkend="language.types.typecasting">Type + casting</link>ì 참조íê³ , ë³ìì íì ë³íìì¹´ê³ ì í ê²½ì°ë + <function>settype</function>ì 참조í기 ë°ëë¤. </simpara> <para> - If you would like to test any of the examples in this section, you - can cut and paste the examples and insert the following line to - see for yourself what's going on: + ì´ ì¹ì ìì ìì 를 í ì¤í¸ í´ë³´ê³ ì íë¤ë©´, ìì 를 php fileì ë³µì¬íê³ + ìëì 문ì¥ì ì¨ì¤ë¤ë©´ ì´ë»ê² ë³ìíì´ ë³íëì§ íì¸í´ ë³¼ì ììê²ì´ë¤. <informalexample> <programlisting role="php"> echo "\$foo==$foo; type is " . gettype ($foo) . "<br>\n"; @@ -540,74 +534,68 @@ </para> <note> <para> - The behaviour of an automatic conversion to array is currently - undefined. + ë°°ì´ììì ìë íë³íì íµìì ì¼ë¡ ì ìëì´ì ¸ ìì§ ìë¤. <informalexample> <programlisting role="php"> -$a = 1; // $a is an integer -$a[0] = "f"; // $a becomes an array, with $a[0] holding "f" - </programlisting> +$a = 1; // $a ë ì ìíì´ë¤ +$a[0] = "f"; // $a ë $a[0]ê° "f"ì ê°ì ê°ì§ ë°°ì´ì´ë¤. </programlisting> </informalexample> </para> <para> - While the above example may seem like it should clearly result in - $a becoming an array, the first element of which is 'f', consider - this: + ìì ìë $aê° ì²«ë²ì§¸ ììë¡ 'f'를 ê°ì§ë ë°°ì´ë¡ íë³í ëëê² ëª ííê² ë³´ì´ì§ë§, + ìëì ê²½ì°ë¥¼ ìê°í´ ë³´ì <informalexample> <programlisting role="php"> -$a = "1"; // $a is a string -$a[0] = "f"; // What about string offsets? What happens? +$a = "1"; // $aë 문ìì´ì´ë¤ +$a[0] = "f"; // 첨ì 0ì´ ë¬¸ìì´ì ëí ì¤íì (offset)ì¸ê°? ì¬ê¸°ìë ì´ë¤ì¼ì´ ì¼ì´ë ê²ì¸ê°? </programlisting> </informalexample> </para> <para> - Since PHP supports indexing into strings via offsets using the - same syntax as array indexing, the example above leads to a - problem: should $a become an array with its first element being - "f", or should "f" become the first character of the string $a? + PHPìì ë°°ì´ì ì¸ë±ì¤(index)ì ê°ì ì¤íì (offset)ì ì´ì©í ì¸ë±ì¤(index)를 + 문ìì´ ë³ììë ì¬ì©í ì ìë¤. ë°ë¼ì ìì ìë ë¤ìê³¼ ê°ì 문ì 를 ìê³ ìë¤.: + $aê° ì²«ë²ì§¸ ììê° "f"ì¸ ë°°ì´ì¸ê°? + "f"ê° ë¬¸ìì´ ë³ì $aì 첫ë²ì§¸ 문ìê° ëì´ì¼ íëê°? </para> <para> - For this reason, as of PHP 3.0.12 and PHP 4.0b3-RC4, the result - of this automatic conversion is considered to be undefined. Fixes - are, however, being discussed. + ì´ë¬í ì´ì ë¡, PHP 3.0.12 and PHP 4.0b3-RC4ìì ìì ê°ì ê²½ì°ì + ìë í ë³íì ì ìëì´ ìì§ ìë¤ê³ íë¤. ì´ì ëí ì íí ì ìë ë ¼ì ëì´ ì§ê²ì´ë¤. </para> </note> <sect2 id="language.types.typecasting"> - <title>Type Casting</title> + <title>í ì ì©(Type Casting)</title> <para> - Type casting in PHP works much as it does in C: the name of the - desired type is written in parentheses before the variable which - is to be cast. + PHPìì íì ì©(type casting)ì C languageììì ë§¤ì° ì ì¬íë¤. + ìíë íì ì ì ì©(casting)ëì´ì§ë ë³ììì ê´í¸ë¡ 묶ì´ì ì¨ ì£¼ê¸°ë§ íë©´ ëë¤. <informalexample> <programlisting role="php"> -$foo = 10; // $foo is an integer -$bar = (double) $foo; // $bar is a double +$foo = 10; // $fooë ì ìíì´ë¤. +$bar = (double) $foo; // $barë type castingì¼ë¡ doubleíì´ë¤ </programlisting> </informalexample> </para> <para> - The casts allowed are: + ìëì ê°ì ê²½ì°ë¥¼ ì ì©í ì ìë¤: <itemizedlist> <listitem> - <simpara>(int), (integer) - cast to integer</simpara> + <simpara>(int), (integer) - ì ìë¡ cast</simpara> </listitem> <listitem> - <simpara>(real), (double), (float) - cast to double</simpara> + <simpara>(real), (double), (float) - doubleíì¼ë¡ cast</simpara> </listitem> <listitem> - <simpara>(string) - cast to string</simpara> + <simpara>(string) - 문ìì´ë¡ cast</simpara> </listitem> <listitem> - <simpara>(array) - cast to array</simpara> + <simpara>(array) - ë°°ì´ë¡ cast</simpara> </listitem> <listitem> - <simpara>(object) - cast to object</simpara> + <simpara>(object) - ê°ì²´(object)ë¡ cast</simpara> </listitem> </itemizedlist> </para> <para> - Note that tabs and spaces are allowed inside the parentheses, so - the following are functionally equivalent: + ê´í¸ìì tabì´ë 공백문ìë íì©ëë¯ë¡ ìëì ë 문ì¥ì ê°ì´ ì·¨ê¸ëë¤. <informalexample> <programlisting role="php"> $foo = (int) $bar; @@ -616,30 +604,28 @@ </informalexample> </para> <para> - It may not be obvious exactly what will happen when casting - between certain types. For instance, the following should be - noted. + í¹ì í íì ì¼ë¡ castingë ëì ê²°ê³¼ë ëª ííì§ ìë¤. + ì를 ë¤ì´ ë¤ìê³¼ ê°ì ê²½ì° ì£¼ì를 ìíë¤. </para> <para> - When casting from a scalar or a string variable to an array, the - variable will become the first element of the array: + ì¤ì¹¼ë¼(scalar)ë³ìë 문ìì´ ë³ìê° ë°°ì´ë¡ castingë ë ê·¸ ë³ìë + ë°°ì´ì 첫ë²ì§¸ ììê° ëë¤. <informalexample> <programlisting role="php"> $var = 'ciao'; $arr = (array) $var; -echo $arr[0]; // outputs 'ciao' +echo $arr[0]; // ê²°ê³¼ê°ì 'ciao' ì´ ëë¤ </programlisting> </informalexample> </para> <para> - When casting from a scalar or a string variable to an object, the - variable will become an attribute of the object; the attribute - name will be 'scalar': + ì¤ì¹¼ë¼(scalar)ë³ìë 문ìì´ ë³ìê° ê°ì²´ë¡ castingë ë ê·¸ ë³ìë + 'scalar'ë¼ë ê°ì²´ì ìì±ê°ì´ ëë¤. <informalexample> <programlisting role="php"> $var = 'ciao'; $obj = (object) $var; -echo $obj->scalar; // outputs 'ciao' +echo $obj->scalar; // ê²°ê³¼ê°ì 'ciao' ì´ ëë¤ </programlisting> </informalexample> </para>