cvs: phpdoc /kr/language references.xml variables.xml
| From: | Jaeyoung Cho | Date: | Tue, 30 Jan 2001 02:25:42 +0000 |
| Subject: | cvs: phpdoc /kr/language references.xml variables.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969334048@lists.php.net to get a copy of this message | ||
pandach Mon Jan 29 18:25:42 2001 EDT
Modified files:
/phpdoc/kr/language references.xml variables.xml
Log:
PR:
Submitted by:
Reviewed by:
Obtained from:
Index: phpdoc/kr/language/references.xml diff -u phpdoc/kr/language/references.xml:1.3 phpdoc/kr/language/references.xml:1.4 --- phpdoc/kr/language/references.xml:1.3 Fri Jan 12 06:16:40 2001 +++ phpdoc/kr/language/references.xml Mon Jan 29 18:25:41 2001 @@ -1,293 +1,118 @@ - <chapter id="language.references"> - <title>References Explained</title> - - <sect1 id="language.references.whatare"> - <title>What References Are</title> - <simpara> - References are a means in PHP to access the same variable content - by different names. They are not like C pointers, they are symbol - table aliases. Note that in PHP, variable name and variable content - are different, so the same content can have different names. - The most close analogy is with Unix filenames and files - - variable names are directory entries, while variable contents is - the file itself. References can be thought of as hardlinking in - Unix filesystem. - </simpara> - </sect1> - - <sect1 id="language.references.whatdo"> - <title>What References Do</title> - <para> - PHP references allow you to make two variables to refer to the - same content. Meaning, when you do: - <informalexample> - <programlisting role="php"> -$a =& $b - </programlisting> - </informalexample> - it means that <varname>$a</varname> and <varname>$b</varname> - point to the same variable. - <note> - <para> - <varname>$a</varname> and <varname>$b</varname> are completely - equal here, that's not <varname>$a</varname> is pointing to - <varname>$b</varname> or vice versa, that's - <varname>$a</varname> and <varname>$b</varname> pointing to the - same place. - </para> - </note> - </para> - <para> - The same syntax can be used with functions, that return references, - and with <literal>new</literal> operator (in PHP 4.0.4 and later): - <informalexample> - <programlisting role="php"> -$bar =& new fooclass(); -$foo =& find_var ($bar); - </programlisting> - </informalexample> - </para> - <note> - <para> - Unless you use the syntax above, the result of - <literal>$bar = new fooclass()</literal> will not be the same - variable as <literal>$this</literal> in the constructor, meaning - that if you have used reference to <literal>$this</literal> in - the constructor, you should use reference assignment, or you get - two different objects. - </para> - </note> - <para> - The second thing references do is to pass variables - by-reference. This is done by making a local variable in a function and - a variable in the calling scope reference to the same content. Example: - <informalexample> - <programlisting role="php"> -function foo (&$var) { - $var++; -} - -$a=5; -foo ($a); - </programlisting> - </informalexample> - will make <varname>$a</varname> to be 6. This happens because in - the function <varname>foo</varname> the variable - <varname>$var</varname> refers to the same content as - <varname>$a</varname>. See also more detailed explanations about <link - linkend="language.references.pass">passing by reference</link>. - </para> - <simpara> - The third thing reference can do is <link - linkend="language.references.return">return by reference</link>. - </simpara> - </sect1> - - <sect1 id="language.references.arent"> - <title>What References Are Not</title> - <para> - As said before, references aren't pointers. That means, the - following construct won't do what you expect: - <informalexample> - <programlisting role="php"> -function foo (&$var) { - $var =& $GLOBALS["baz"]; -} -foo($bar); - </programlisting> - </informalexample> - </para> - <simpara> - What happens is that <varname>$var</varname> in foo will be bound - with <varname>$bar</varname> in caller, but then it will be - re-bound with <varname>$GLOBALS["baz"]</varname>. There's no way - to bind <varname>$bar</varname> in the calling scope to something else - using the reference mechanism, since <varname>$bar</varname> is not - available in the function foo (it is represented by - <varname>$var</varname>, but <varname>$var</varname> has only - variable contents and not name-to-value binding in the calling - symbol table). - </simpara> - </sect1> - - <sect1 id="language.references.pass"> - <title>Passing by Reference</title> - <para> - You can pass variable to function by reference, so that function could modify - its arguments. The sytax is as follows: - <informalexample> - <programlisting role="php"> -function foo (&$var) { - $var++; -} - -$a=5; -foo ($a); -// $a is 6 here - </programlisting> - </informalexample> - Note that there's no reference sign on function call - only on - function definition. Function definition alone is enough to - correctly pass the argument by reference. - </para> - <para> - Following things can be passed by reference: - <itemizedlist> - <listitem> - <simpara> - Variable, i.e. <literal>foo($a)</literal> - </simpara> - </listitem> - <listitem> - <simpara> - New statement, i.e. <literal>foo(new foobar())</literal> - </simpara> - </listitem> - <listitem> - <para> - Reference, returned from a function, i.e.: - <informalexample> - <programlisting role="php"> -function &bar() -{ - $a = 5; - return $a; -} -foo(bar()); - </programlisting> - </informalexample> - See also explanations about <link - linkend="language.references.return">returning by reference</link>. - </para> - </listitem> - </itemizedlist> - </para> - <para> - Any other expression should not be passed by reference, as the - result is undefined. For example, the following examples of passing - by reference are invalid: - <informalexample> - <programlisting role="php"> -function bar() // Note the missing & -{ - $a = 5; - return $a; -} -foo(bar)); - -foo($a = 5) // Expression, not variable -foo(5) // Constant, not variable - </programlisting> - </informalexample> -These requirements are for PHP 4.0.4 and later. - </para> - </sect1> - - <sect1 id="language.references.return"> - <title>Returning References</title> - <para> - Returning by-reference is useful when you want to use a function - to find which variable a reference should be bound to. When - returning references, use this syntax: - <informalexample> - <programlisting role="php"> -function &find_var ($param) { - ...code... - return $found_var; -} - -$foo =& find_var ($bar); -$foo->x = 2; - </programlisting> - </informalexample> - In this example, the property of the object returned by the - <varname>find_var</varname> function would be set, not the - copy, as it would be without using reference syntax. - </para> - <note> - <simpara> - Unlike parameter passing, here you have to use - <literal>&</literal> in both places - to indicate that you - return by-reference, not a copy as usual, and to indicate that - reference binding, rather than usual assignment, should be done - for <varname>$foo</varname>. - </simpara> - </note> - </sect1> - - <sect1 id="language.references.unset"> - <title>Unsetting References</title> - <para> - When you unset the reference, you just break the binding between - variable name and variable content. This does not mean that - variable content will be destroyed. For example: - <informalexample> - <programlisting role="php"> -$a = 1; -$b =& $a; -unset ($a); - </programlisting> - </informalexample> - won't unset <varname>$b</varname>, just <varname>$a</varname>. - </para> - <simpara> - Again, it might be useful to think about this as analogous to Unix - <command>unlink</command> call. - </simpara> - </sect1> - - <sect1 id="language.references.spot"> - <title>Spotting References</title> - <simpara> - Many syntax constructs in PHP are implemented via referencing - mechanisms, so everything told above about reference binding also - apply to these constructs. Some constructs, like passing and - returning by-reference, are mentioned above. Other constructs that - use references are: - </simpara> - - <sect2 id="references.global"> - <title><literal>global</literal> References</title> - <para> - When you declare variable as <command>global $var</command> you - are in fact creating reference to a global variable. That means, - this is the same as: - <informalexample> - <programlisting role="php"> -$var =& $GLOBALS["var"]; - </programlisting> - </informalexample> - </para> - <simpara> - That means, for example, that unsetting <varname>$var</varname> - won't unset global variable. - </simpara> - </sect2> - - <sect2 id="references.this"> - <title><literal>$this</literal></title> - <simpara> - In an object method, <varname>$this</varname> is always reference - to the caller object. - </simpara> - </sect2> - </sect1> - - </chapter> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -sgml-parent-document:nil -sgml-default-dtd-file:"../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: ---> +<!-- edited with XML Spy v3.0.7 NT (http://www.xmlspy.com) by panda (bra) --><chapter id="language.references"> <title>References Explained</title> <sect1 id="language.references.whatare"> <title>참조(Reference)ë 무ìì¸ê°.</title> <simpara> + 참조ë PHPìì ëì¼í ê°ì ìë¡ë¤ë¥¸ ì´ë¦ì¼ë¡ access íë ê²ì ë§íë¤. + 참조ë Cì¸ì´ ììì pointerìë 구ë³ëë©°, simbol tableê³¼ ê°ë¤ê³ í ì ìë¤. PHP + ììë ë³ìëª ê³¼ ë³ìê°ì´ ë¤ë¥´ë¤ëê²ì 주ì í´ì¼ íë¤. ë°ë¼ì, ëì¼í + ë´ì©ì´ ë¤ë¥¸ ì´ë¦ì ê°ì§ì ìë¤. ì´ë ë³ìê°ì´ íì¼ì´ì§ë§ ë³ìëª ì + ëë í 리ì ììì¸ UNIXìì fileê³¼ filenameê³¼ì ê´ê³ì 매ì°ì ì¬íë¤. + 참조ë UNIX íì¼ ìì¤í ììì hardlinkingì¼ë¡ ìê°í ì ìë¤. + </simpara> </sect1> <sect1 id="language.references.whatdo"> <title>ì°¸ì¡°ë¡ í ì ìëì¼ì(What References Do)</title> <para> + 첫ë²ì§¸ë¡ PHPììì 참조ë ëê°ì ë¤ë¥¸ ë³ìê° ëì¼í ë´ì©(content)를 + ê°ë¦¬í¬ì ìê² íë¤. ë¤ìë§í´ ë¤ìê³¼ ê°ì 문ì¥ì´ ìë¤ë©´ + <informalexample> <programlisting role="php"> +$a =& $b + </programlisting> </informalexample> + ì´ë +<varname>$a</varname> ì<varname>$b</varname> + ë ëì¼í ë³ìë¼ê³ í ì ìë¤ <note> <para> <varname>$a</varname> ì<varname>$b</varname> ë ì´ ë¬¸ì¥ììë ìë²½íê² ëì¼í ë³ìì´ì§ë§,<varname>$a</varname> ê° <varname>$b</varname> 를 ê°ë¦¬í¨ë¤. ì´ë ë¤ìë§í´ <varname>$a</varname> ì<varname>$b</varname> ë ëì¼í ìì¹ì ë´ì©(content)를 ì§ì¹íê³ ìë¤. + </para> </note> </para> <para> + í¨ìììë ë³ììì ì ì©ëë ê²ê³¼ ëì¼íê² ì ì©ëë¤. <literal>new</literal> ë¼ë ì°ì°ì를 ì¬ì©íì¬ ì°¸ì¡°ë¥¼ ëë ¤ì¤ì ìë¤.(ì´ë PHP 4.0.4ì´í ë²ì ¼ì ì ì©ëë¤.) <informalexample> <programlisting role="php"> +$bar =& new fooclass(); +$foo =& find_var ($bar); + </programlisting> </informalexample> </para> <note> <para> + Unless you use the syntax above, the result of + <literal>$bar = new fooclass()</literal> will not be the same + variable as <literal>$this</literal> in the constructor, meaning + that if you have used reference to <literal>$this</literal> in + the constructor, you should use reference assignment, or you get + two different objects. + </para> </note> <para> ì°¸ì¡°ë¡ í ì ìë ëë²ì§¸ ê²ì 참조ì ìí ë³ìì ì ë¬ì´ë¤. ì´ë í¨ì ë´ìì ìì±ë ì§ìë³ìì í¨ì를 í¸ì¶í ììì ë³ìê° ëì¼í ê°ì ê°ë¦¬í¤ê² í ì ìë¤. + ìëì ì를 ë³´ì<informalexample> <programlisting role="php"> +function foo (&$var) { + $var++; +} + +$a=5; +foo ($a); + </programlisting> </informalexample><varname>$a</varname> ì ê°ì 6ì´ ëë¤. ì´ë í¨ì<varname>foo</varname> ë´ì ì§ìë³ì <varname>$var</varname> ê° í¨ì를 í¸ì¶í ììì ë³ì <varname>$a</varname>ì ëì¼í ê°(content)ì 참조í기 ë문ì´ë¤. ì´ì ëí ì¢ ë ìì¸í ì¤ëª ì<link linkend="language.references.pass">참조ì ìí ì ë¬(passing by reference)</link>ì íì¸í´ 보기 ë°ëë¤. + </para> <simpara> ì¸ë²ì§¸ë¡ 참조ë¡ì í ì ìë ê²ì<link linkend="language.references.return">참조ì ìí return(return by reference)</link>ì´ë¤. + </simpara> </sect1> <sect1 id="language.references.arent"> <title>참조를 ì¬ì©í¨ì ìì´ ì£¼ì í´ì¼ í ê²(What References Are Not)</title> <para> ìì ë§íë¯ì´ 참조ë C ì¸ì´ììì pointerìë ë¤ë¥´ë¤. ìëì ì를 ë³´ê³ ê·¸ ê²°ê³¼ê° ì°ë¦¬ê° 기ëíë ê²ê³¼ ë¤ë¥´ë¤ë ê²ì ìë¤ë©´ 참조(reference)ì pointerê° ë¤ë¥´ë¤ë ê²ì ìì ìì ê²ì´ë¤. + <informalexample> <programlisting role="php"> +function foo (&$var) { + $var =& $GLOBALS["baz"]; +} +foo($bar); + </programlisting> </informalexample> </para> <simpara> ìì ììì fooí¨ì ë´ì ë³ì<varname>$var</varname> ë í¨ì를 í¸ì¶í ììì ë³ì<varname>$bar</varname> ì ëì¼í ê°ì 참조íì§ë§ ê³§ì´ì´ ì ìë³ì<varname>$GLOBALS["baz"]</varname>ê° ì°¸ì¡°íë ê°ì 참조íëë¡ ë°ëë¤. ì´ì ì´ í¨ìë´ìì 참조ì ë©ì¹´ëì¦ì ì¬ì©íì¬ í¨ì를 í¸ì¶í ììì ë³ì<varname>$bar</varname> 를 참조í ì ìë ë°©ë²ì´ ìë¤. ë°ë¼ì í¨ì를 í¸ì¶í ììì ë³ì<varname>$bar</varname> ë í¨ì fooë´ììë 무ì 미í ì ë°ì ìë¤. (ì¦ í¨ì를 í¸ì¶í ììì ë³ìë í¨ìë´ì ë³ì<varname>$var</varname>ì ìí´ ëíë¼ì ìì§ë§,<varname>$var</varname> ë ë¨ì§ ë³ìê°ì´ì§ symbol tableì ì ìë ë³ìëª ì´ ìëë¤.) </simpara> </sect1> <sect1 id="language.references.pass"> <title>참조를 ì¬ì©í ì ë¬(Passing by Reference)</title> <para> 참조(reference)를 ì¬ì©íì¬ ë³ì를 í¨ìë¡ ë겨 ì ë¬(pass)í ì ìë¤. ê·¸ëì í¨ì ë´ìì ë³ìì ê°ì ìì í ì ìë¤. ë¤ìì´ ê·¸ ìì´ë¤.<informalexample> <programlisting role="php"> +function foo (&$var) { + $var++; +} + +$a=5; +foo ($a); +// $a is 6 here + </programlisting> </informalexample> í¨ì를 í¸ì¶í ë 참조를 ì´ì©íì¬ ë³ì를 ì ë¬(pass)íë¤ë ì´ë í íìë ìë¤ë ê²ì 주ìíì. ë¨ì§ í¨ì를 ì ì í ë ë³ì를 참조ì ìí´ ì ë¬ ë°ëë¤ë íìê° ìë¤. í¨ì를 ì ìí ë ì´ë¥¼ ì ì í¨ì¼ë¡ì¨ 참조ì ìí ë³ì ì ë¬ì´ ê°ë¥íë¤. </para> <para> 참조ì ìí´ ë³ì를 ë겨 주ë ë°©ë²ì ë¤ìì ì¸ê°ì§ ë°©ë²ì´ ìë¤: <itemizedlist> <listitem> <simpara> ë³ìì ìí ë°©ë², ì¦.<literal>foo($a)</literal> </simpara> </listitem> <listitem> <simpara> Newë¼ë 문ì¥ì ì´ì©íë ë°©ë², ì¦.<literal>foo(new foobar())</literal> </simpara> </listitem> <listitem> <para> í¨ìë¡ ë¶í° ë겨 ë°ë 참조ì ìí ë°©ë², ì¦. <informalexample> <programlisting role="php"> +function &bar() +{ + $a = 5; + return $a; +} +foo(bar()); + </programlisting> </informalexample><link linkend="language.references.return">참조ì ìí 리í´(returning by reference)</link>ì ìì¸í ì¤ëª ì ë³¼ì ìë¤. + </para> </listitem> </itemizedlist> </para> <para> ìì ëì´í ì¸ê°ì§ ë°©ë²ì¸ìë 참조ì ìí ì ë¬(pass)ì í ì ìë¤. ì를 ë¤ë©´ ìë ìì ê°ì ë°©ë²ì¼ë¡ 참조ì ìí ì ë¬ì ê·¸ ìë¯¸ê° ê·¸ ìë¯¸ê° ì ííì§ ëª»íë¤.<informalexample> <programlisting role="php"> +function bar() // & ê° ë¹ ì ¸ììì ì ìíì; +{ + $a = 5; + return $a; +} +foo(bar)); + +foo($a = 5) // ííì(Expression)ì ë³ìê° ìëë¤. +foo(5) // ìì(Constant)ë ë³ìê° ìëê°. + </programlisting> </informalexample> ì´ ëª¨ë ê²ì PHP 4.0.4 ì´ìì ë²ì ¼ì í´ë¹ëë¤. </para> </sect1> <sect1 id="language.references.return"> <title>ì°¸ì¡°ê° ë¦¬í´(Returning References)</title> <para> ì°¸ì¡°ê° ë¦¬í´ì ë³ìê° ì´ë¤ê°ì 참조íë ì§ë¥¼ ì°¾ë í¨ì를 ì¬ì©í ë ì ì©íë¤. ì°¸ì¡°ê° ë¦¬í´ì 문ë²ì ë¤ìê³¼ ê°ë¤<informalexample> <programlisting role="php"> +function &find_var ($param) { + ...code... + return $found_var; +} + +$foo =& find_var ($bar); +$foo->x = 2; + </programlisting> </informalexample> ìì ììì í¨ì<varname>find_var</varname>ì ìí´ ë¦¬í´ë ê°ì²´ì ìì±ì ë³µì¬ëì´ ì§ë ê²ì´ ìëë¼ ì ì(set)ëì´ ì§ë¤.참조ì 문ë²ì ì¬ì©íì§ ìê³ ë ê°ë¥íë¤.</para> <note> <simpara> ì°¸ì¡°ê° ë¦¬í´ ì´ë¼ë ê²ì íì í기ìí´ ì¸ìì ë¬ê³¼ë ë¬ë¦¬ í¨ì를 í¸ì¶íë 쪽과 í¸ì¶ëì´ì§ë í¨ì ì쪽ì <literal>&</literal>기í¸ê° ìì´ì¼ íë¤. ì´ë¡ ì¸í´ ì¼ë°ì ì¼ë¡ í¨ìê°ì 리í´ë°©ìì¸ ë³µì¬ì ìí ë°©ë²ì´ ìëë¼ ì°¸ì¡°ë¥¼ ì¬ì©í 리í´ì´<varname>$foo</varname>ë¡ ê°ë¥í´ ì§ ê²ì´ë¤. + </simpara> </note> </sect1> <sect1 id="language.references.unset"> <title>참조ì§ì ìì 기(Unsetting References)</title> <para> 참조ë ê°ì ìì ë ¤ë©´ ë³ìëª ê³¼ ê·¸ê° ê°ë¦¬í¤ë ë´ì©(content)ìì ì°ê²°ê³ 리를 ëì¼ë©´ ëë¤. ì´ë ê² íë¤ê³ í´ì ë³ìê° ê°ë¦¬í¤ë ë´ì© ìì²´ê° ìì´ì§ë¤ë ê²ì ì미íì§ë ìëë¤. ìëì ì를 ë³´ì: + <informalexample> <programlisting role="php"> +$a = 1; +$b =& $a; +unset ($a); + </programlisting> </informalexample> ë³ì<varname>$b</varname>ì 참조ë ê°ì ìì¤ê²ì´ ìëë¼ ë¨ì§ ë³ì<varname>$a</varname>ê° ì§ìíë ê²ì ìì´ë¤. + </para> <simpara> ë¤ìë§í´, ì´ë Unix ìì¤í ìì <command>unlink</command>를 í¸ì¶íë ê²ê³¼ ìë¹í ì ì¬íë¤. </simpara> </sect1> <sect1 id="language.references.spot"> <title>Spotting References</title> <simpara> + Many syntax constructs in PHP are implemented via referencing + mechanisms, so everything told above about reference binding also + apply to these constructs. Some constructs, like passing and + returning by-reference, are mentioned above. Other constructs that + use references are: + </simpara> <sect2 id="references.global"> <title> <literal>global</literal> References</title> <para> + When you declare variable as <command>global $var</command> you + are in fact creating reference to a global variable. That means, + this is the same as: + <informalexample> <programlisting role="php"> +$var =& $GLOBALS["var"]; + </programlisting> </informalexample> </para> <simpara> + That means, for example, that unsetting <varname>$var</varname> + won't unset global variable. + </simpara> </sect2> <sect2 id="references.this"> <title> <literal>$this</literal> </title> <simpara> + In an object method, <varname>$this</varname> is always reference + to the caller object. + </simpara> </sect2> </sect1></chapter><!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +--> \ No newline at end of file Index: phpdoc/kr/language/variables.xml diff -u phpdoc/kr/language/variables.xml:1.1 phpdoc/kr/language/variables.xml:1.2 --- phpdoc/kr/language/variables.xml:1.1 Tue Jan 9 00:23:41 2001 +++ phpdoc/kr/language/variables.xml Mon Jan 29 18:25:41 2001 @@ -1,64 +1,22 @@ -<chapter id="language.variables"> - <title>ë³ì (Variables)</title> - <sect1 id="language.variables.basics"> - <title>기본(Basics)</title> - <simpara> - Variables in PHP are represented by a dollar sign followed by the - name of the variable. The variable name is case-sensitive. - </simpara> - <para> - Variable names follow the same rules as other labels in PHP. A - valid variable name starts with a letter or underscore, followed - by any number of letters, numbers, or underscores. As a regular - expression, it would be expressed thus: - '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' - </para> - <note> - <simpara> - For our purposes here, a letter is a-z, A-Z, and the ASCII - characters from 127 through 255 (0x7f-0xff). - </simpara> - </note> - <para> - <informalexample> - <programlisting role="php"> +<!-- edited with XML Spy v3.0.7 (http://www.xmlspy.com) by panda (bra) --><chapter id="language.variables"> <title>ë³ì (Variables)</title> <sect1 id="language.variables.basics"> <title>기본(Basics)</title> <simpara> PHPìì ë³ìë ì´ë¦ìì ë¬ë¬íì($)를 ë¶ì¬ì ì¬ì©íë¤. ëí ë³ìëª ì ìì´ ëì문ìë 구ë¶íë¤. </simpara> <para> ë³ìëª ì PHPë´ì ë¤ë¥¸ ë¼ë²¨ëª ì ì ìíë ê²ê³¼ ëì¼í ê·ì¹ì ì ì© ë°ëë¤. ì í¨í ë³ìëª ì 문ìë í¹ì ì¸ëì¤ì½ì(_)ë¡ ììíì¬ì¼ íê³ , ëë²ì§¸ 문ìë¶í°ë 문ìë ì«ì,ì¸ëì¤ì½ìë±ì ì¬ì©í ì ìê³ ê¸¸ì´ìë ì íì´ ìë¤. ì ê·ìì¼ë¡ íííìë©´ ë¤ìê³¼ ê°ì´ ëíë¼ì ìë¤. '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' + </para> <note> <simpara> + a-z, A-Z ì¬ì´ì ìí벳과 ASCII code 127ë¶í° 255ê¹ì§ë¥¼ ì미íë¤ (0x7f-0xff). + </simpara> </note> <para> <informalexample> <programlisting role="php"> $var = "Bob"; $Var = "Joe"; -echo "$var, $Var"; // outputs "Bob, Joe" +echo "$var, $Var"; // ê²°ê³¼ê°ì "Bob, Joe" -$4site = 'not yet'; // invalid; starts with a number -$_4site = 'not yet'; // valid; starts with an underscore -$t㸴e = 'mansikka'; // valid; '⥠is ASCII 228. - </programlisting> - </informalexample> - </para> - <para> - In PHP 3, variables are always assigned by value. That is to say, - when you assign an expression to a variable, the entire value of - the original expression is copied into the destination - variable. This means, for instance, that after assigning one - variable's value to another, changing one of those variables will - have no effect on the other. For more information on this kind of - assignment, see <link linkend="language.expressions">Expressions</link>. - </para> - <para> - PHP 4 offers another way to assign values to variables: - <emphasis>assign by reference</emphasis>. This means that the new - variable simply references (in other words, "becomes an alias for" - or "points to") the original variable. Changes to the new variable - affect the original, and vice versa. This also means that no - copying is performed; thus, the assignment happens more - quickly. However, any speedup will likely be noticed only in tight - loops or when assigning large arrays or objects. - </para> - <para> +$4site = 'not yet'; // ë³ìëª ì´ ì«ìë¡ ììíì¼ë¯ë¡ ê·ì¹ì ìë°°ëë¤ +$_4site = 'not yet'; // ì¸ëì¤ì½ìë¡ ììë ë³ìë ì¬ì©í ì ìë¤. +$t_e = 'mansikka'; // '_ë ASCII 228ë²ì§¸ 문ìì´ë¯ë¡ ì í¨íë¤. + </programlisting> </informalexample> </para> <para> PHP 3 ìì ë³ìë íì ê°ì ê°ì§ê³ ìë¤. ì´ë ë¤ìë§í´ì, ííìì ê°ì ë³ìì ì ì©íë©´ ííìì ê²°ê³¼ê°ì´ ë³ìë¡ ë³µì¬ëë¤. ííìì ê°ì ë³ìì ë³µì¬íë¯ë¡ ë³µì¬ëê³ ë íì ííìì ë³íë ë³ìì ëì´ì ìí¥ì ì£¼ì§ ìëë¤ê³ í ì ìë¤. ì´ì ëí ìì¸í ì¤ëª ì <link linkend="language.expressions">ííì(Expressions)</link>ì 참조í기 ë°ëë¤. + </para> <para> PHP 4 ììë ë³ìì ê°ì ì§ì íë ë¤ë¥¸ ë°©ë²ì ì ìíê³ ìë¤: <emphasis>참조(reference)를 ì¬ì©í ê° ì§ì (assign)</emphasis>. ì´ë ìë¡ì´ ë³ìê° ê°ì ë³µì¬íì¬ ê°ì§ê³ ì¤ë ê²ì´ ìëë¼ ìë ê°ì´ ìë ê³³ì ë¨ìí 참조íë ë°©ë²ì´ë¤. ìë ê°ì´ ìë ë³ìì ë³ì¹ì´ ëë¤ë¼ê³ í ìë ìê³ ìë ë³ì를 ê°ë¦¬í¨ë¤ê³ ííí ìë ìê² ë¤. ìë¡ì´ ë³ìê°ì ë³íë ìëë³ìì ê°ì ìí¥ì ì£¼ê³ ë°ëë¡ ìëë³ìì ê°ì´ ë³íì¬ë ìë¡ì´ ë³ìì ìí¥ì 미ì¹ë¤. ê²°ì½ ê°ì ë³µì¬íë ê²ê³¼ë ë¤ë¥¸ ê°ë ì´ë¼ í ì ìë¤. ë°ë¼ì í¬ê¸°ê° í° ë°°ì´ì´ë ê°ì²´ë¥¼ ì§ì í ëë ë°ë³µë¬¸ì ìííëë° ìì´ ìíìëê° ë¹¨ë¼ì¡ë¤. </para> <para> To assign by reference, simply prepend an ampersand (&) to the beginning of the variable which is being assigned (the source variable). For instance, the following code snippet outputs 'My name is Bob' twice: - <informalexample> - <programlisting role="php"> + <informalexample> <programlisting role="php"> <?php $foo = 'Bob'; // Assign the value 'Bob' to $foo $bar = &$foo; // Reference $foo via $bar. @@ -66,14 +24,10 @@ echo $foo; // $foo is altered too. echo $bar; ?> - </programlisting> - </informalexample> - </para> - <para> + </programlisting> </informalexample> </para> <para> One important thing to note is that only named variables may be assigned by reference. - <informalexample> - <programlisting role="php"> + <informalexample> <programlisting role="php"> <?php $foo = 25; $bar = &$foo; // This is a valid assignment. @@ -85,172 +39,66 @@ $bar = &test(); // Invalid. ?> - </programlisting> - </informalexample> - </para> - </sect1> - <sect1 id="language.variables.predefined"> - <title>미리 ì ìë ë³ì (Predefined variables)</title> - <simpara> - PHPë 모ë ì¤í¬ë¦½í¸ì ëí´ ê·¸ ì¤í¬ë¦½í¸ê° ì¤í ë ë ì¬ë¬ê°ì 미리 ì ìë ë³ì를 ì ê³µíë¤. - ì´ ë³ìì¤ ìë²ì ì¢ ë¥ë ë²ì , 기í ë¤ë¥¸ ìì¸ì¼ë¡ ì¸í´ ë¬ë¼ì§ë ê²ë ë§ìë°, ê·¸ë° ë³ìë ì´ê³³ì 문ìí ëì§ ììë¤. - ëí ì´ ë³ìì¤ ë¤ìë PHPê° command-lineì¼ë¡ ëìí ëë ì¬ì©í ì ìë¤. - </simpara> - <simpara> + </programlisting> </informalexample> </para> </sect1> <sect1 id="language.variables.predefined"> <title>미리 ì ìë ë³ì (Predefined variables)</title> <simpara>PHPë 모ë ì¤í¬ë¦½í¸ì ëí´ ê·¸ ì¤í¬ë¦½í¸ê° ì¤í ë ë ì¬ë¬ê°ì 미리 ì ìë ë³ì를 ì ê³µíë¤. +ì´ ë³ìì¤ ìë²ì ì¢ ë¥ë ë²ì , 기í ë¤ë¥¸ ìì¸ì¼ë¡ ì¸í´ ë¬ë¼ì§ë ê²ë ë§ìë°, ê·¸ë° ë³ìë ì´ê³³ì 문ìí ëì§ ììë¤. +ëí ì´ ë³ìì¤ ë¤ìë PHPê° command-lineì¼ë¡ ëìí ëë ì¬ì©í ì ìë¤. + </simpara> <simpara> ì´ë° ì¬ë¬ ìì¸ì´ ìì§ë§ ì´ê³³ììë ê°ì¥ ì¼ë°ì ì¸ íê²½ì¸ <ulink url="&url.apache;">Apache</ulink> 1.3.6 ìì 모ëë¡ PHP3를 ì¤ì¹í íê²½ììì 미리 ì ìë ë³ì를 ì´í´ë³´ëë¡ íì. - </simpara> - <simpara> + </simpara> <simpara> ì¬ë¬ë¶ì´ ì¬ì©íë ìì¤í ì 모ë 미리 ì ìë ë³ì를 ë³´ë ¤ë©´ <function>phpinfo</function> í¨ì를 ì¬ì©íì. (ì´ í¨ìë ë¤ë¥¸ ì¬ë¬ ì ì©í ì ë³´ë ìë ¤ì¤ë¤.) - </simpara> - <note> - <simpara> + </simpara> <note> <simpara> ì¬ê¸°ëì¨ ëª©ë¡ì ìì íì§ ìë¤. (ìë²½í ìê°ë ìë¤.) ì´ ëª©ë¡ì ë¨ìí ì¬ë¬ë¶ì ì¤í¬ë¦½í¸ìì ì´ë¤ ì¢ ë¥ì 미리 ì ìë ë³ìê° ì¬ì©ë ì ìëê°ì ììì¼ ë¿ì´ë¤. - </simpara> - </note> - <sect2 id="language.variables.predefined.apache"> - <title>Apache variables</title> - <simpara> + </simpara> </note> <sect2 id="language.variables.predefined.apache"> <title>Apache variables</title> <simpara> ì´ ë³ìë <ulink url="&url.apache;">Apache</ulink> ì¹ìë²ë¡ë¶í° ìì±ë ê²ì´ë¤. ë§ì½ ì¬ë¬ë¶ì´ ë¤ë¥¸ ì¹ìë²ë¥¼ ì¬ì©íê³ ìë¤ë©´ ì´ì ëì¼í ë³ìê° ìì±ëë¤ê³ ë³´ì¥í ì ìë¤. ìë§ë ì¼ë¶ë ìì´ì§ê³ , ì¬ê¸°ì ìë ë³ìê° ìë¡ ì길 ê²ì´ë¤. ì¬ê¸°ì ìë ë³ìì¤ ëë¶ë¶ì <ulink url="&url.cgispec;">CGI 1.1 specification</ulink>ìì ëì¨ ê²ì´ê³ , ê·¸ ë´ì©ëë¡ ì¬ì©ëë¤. - </simpara> - <simpara> + </simpara> <simpara> ì´ê³³ì ìë ë³ìì¤ PHPê° command lineì¼ë¡ ëìí ê²½ì° ì¬ì©ë ì ìë ê²ì ê±°ì ìë¤. - </simpara> - <para> - <variablelist> - <varlistentry> - <term>GATEWAY_INTERFACE</term> - <listitem> - <simpara> + </simpara> <para> <variablelist> <varlistentry> <term>GATEWAY_INTERFACE</term> <listitem> <simpara> ìë²ê° ì¬ì©íê³ ìë CGI specificationì revision. ì: 'CGI/1.1'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_NAME</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_NAME</term> <listitem> <simpara> íì¬ ì¤í¬ë¦½í¸ê° ì¤íëê³ ìë í¸ì¤í¸ì ì´ë¦. ë§ì½ ì¤í¬ë¦½í¸ê° ê°ì í¸ì¤í¸ìì ì¤íëê³ ìë¤ë©´, ì´ ê°ì ê°ì í¸ì¤í¸ì ê°ì´ ë ê²ì´ë¤. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_SOFTWARE</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_SOFTWARE</term> <listitem> <simpara> ì구ì ëí ëëµì í¤ëì ì¬ì©í ìë² identification 문ìì´ - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_PROTOCOL</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_PROTOCOL</term> <listitem> <simpara> íì´ì§ê° ì구ëì´ì§ ë ì¬ì©í íë¡í ì½ì ì´ë¦ê³¼ 리ë¹ì ¼. ì: 'HTTP/1.0'; - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>REQUEST_METHOD</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>REQUEST_METHOD</term> <listitem> <simpara> Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>QUERY_STRING</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>QUERY_STRING</term> <listitem> <simpara> í´ë¹ íì´ì§ë¥¼ ì ê·¼í ë ì¬ì©ë query string. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>DOCUMENT_ROOT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>DOCUMENT_ROOT</term> <listitem> <simpara> íì¬ ì¤í¬ë¦½í¸ê° ìíì¤ì¸ document root ëë í 리. ìë²ì ì¤ì íì¼ì ì ìëì´ ìë¤. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ACCEPT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_ACCEPT</term> <listitem> <simpara> Contents of the <literal>Accept:</literal> header from the current request, if there is one. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ACCEPT_CHARSET</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_ACCEPT_CHARSET</term> <listitem> <simpara> Contents of the <literal>Accept-Charset:</literal> header from the current request, if there is one. Example: 'iso-8859-1,*,utf-8'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ENCODING</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_ENCODING</term> <listitem> <simpara> Contents of the <literal>Accept-Encoding:</literal> header from the current request, if there is one. Example: 'gzip'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ACCEPT_LANGUAGE</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_ACCEPT_LANGUAGE</term> <listitem> <simpara> Contents of the <literal>Accept-Language:</literal> header from the current request, if there is one. Example: 'en'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_CONNECTION</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_CONNECTION</term> <listitem> <simpara> Contents of the <literal>Connection:</literal> header from the current request, if there is one. Example: 'Keep-Alive'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_HOST</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_HOST</term> <listitem> <simpara> Contents of the <literal>Host:</literal> header from the current request, if there is one. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_REFERER</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_REFERER</term> <listitem> <simpara> The address of the page (if any) which referred the browser to the current page. This is set by the user's browser; not all browsers will set this. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_USER_AGENT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_USER_AGENT</term> <listitem> <simpara> Contents of the <literal>User_Agent:</literal> header from the current request, if there is one. This is a string denoting the browser software being used to view the current @@ -259,128 +107,57 @@ this value with <function>get_browser</function> to tailor your page's functionality to the capabilities of the user's browser. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>REMOTE_ADDR</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>REMOTE_ADDR</term> <listitem> <simpara> The IP address from which the user is viewing the current page. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>REMOTE_PORT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>REMOTE_PORT</term> <listitem> <simpara> The port being used on the user's machine to communicate with the web server. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SCRIPT_FILENAME</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SCRIPT_FILENAME</term> <listitem> <simpara> The absolute pathname of the currently executing script. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_ADMIN</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_ADMIN</term> <listitem> <simpara> The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_PORT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_PORT</term> <listitem> <simpara> The port on the server machine being used by the web server for communication. For default setups, this will be '80'; using SSL, for instance, will change this to whatever your defined secure HTTP port is. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_SIGNATURE</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_SIGNATURE</term> <listitem> <simpara> String containing the server version and virtual host name which are added to server-generated pages, if enabled. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>PATH_TRANSLATED</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>PATH_TRANSLATED</term> <listitem> <simpara> Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SCRIPT_NAME</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SCRIPT_NAME</term> <listitem> <simpara> Contains the current script's path. This is useful for pages which need to point to themselves. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>REQUEST_URI</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>REQUEST_URI</term> <listitem> <simpara> The URI which was given in order to access this page; for instance, '/index.html'. - </simpara> - </listitem> - </varlistentry> - </variablelist> - </para> - </sect2> - <sect2 id="language.variables.predefined.environment"> - <title>Environment variables</title> - <simpara> + </simpara> </listitem> </varlistentry> </variablelist> </para> </sect2> <sect2 id="language.variables.predefined.environment"> <title>Environment variables</title> <simpara> These variables are imported into PHP's global namespace from the environment under which the PHP parser is running. Many are provided by the shell under which PHP is running and different systems are likely running different kinds of shells, a definitive list is impossible. Please see your shell's documentation for a list of defined environment variables. - </simpara> - <simpara> + </simpara> <simpara> Other environment variables include the CGI variables, placed there regardless of whether PHP is running as a server module or CGI processor. - </simpara> - </sect2> - <sect2 id="language.variables.predefined.php"> - <title>PHP variables</title> - <simpara> + </simpara> </sect2> <sect2 id="language.variables.predefined.php"> <title>PHP variables</title> <simpara> These variables are created by PHP itself. The <varname>$HTTP_*_VARS</varname> variables are available only if the <link linkend="ini.track-vars">track_vars</link> configuration is turned on. - </simpara> - <note> - <para> + </simpara> <note> <para> As of PHP 4.0.3, <link linkend="ini.track-vars">track_vars</link> is always turned on, regardless of the configuration file setting. - </para> - </note> - <para> + </para> </note> <para> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the @@ -391,124 +168,53 @@ possibly malicious intent. If you cannot turn off <link linkend="ini.register-globals">register_globals</link>, you must take whatever steps are necessary to ensure that the data you are using is safe. - </para> - <para> - <variablelist> - <varlistentry> - <term>argv</term> - <listitem> - <simpara> + </para> <para> <variablelist> <varlistentry> <term>argv</term> <listitem> <simpara> Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>argc</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>argc</term> <listitem> <simpara> Contains the number of command line parameters passed to the script (if run on the command line). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>PHP_SELF</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>PHP_SELF</term> <listitem> <simpara> The filename of the currently executing script, relative to the document root. If PHP is running as a command-line processor, this variable is not available. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_COOKIE_VARS</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_COOKIE_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script via HTTP cookies. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_GET_VARS</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_GET_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script via the HTTP GET method. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_POST_VARS</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_POST_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script via the HTTP POST method. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_POST_FILES</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_POST_FILES</term> <listitem> <simpara> An associative array of variables containing information about files uploaded via the HTTP POST method. See <link linkend="features.file-upload.post-method">POST method uploads</link> for information on the contents of <varname>$HTTP_POST_FILES</varname>. - </simpara> - <para> - <varname>$HTTP_POST_FILES</varname> is available only in PHP + </simpara> <para> <varname>$HTTP_POST_FILES</varname> is available only in PHP 4.0.0 and later. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ENV_VARS</term> - <listitem> - <simpara> + </para> </listitem> </varlistentry> <varlistentry> <term>HTTP_ENV_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script via the parent environment. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_SERVER_VARS</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_SERVER_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script from the HTTP server. These variables are analogous to the Apache variables described above. - </simpara> - </listitem> - </varlistentry> - </variablelist> - </para> - </sect2> - </sect1> - <sect1 id="language.variables.scope"> - <title>ë³ì ì¬ì© ë²ì (Variable Scope)</title> - <simpara> + </simpara> </listitem> </varlistentry> </variablelist> </para> </sect2> </sect1> <sect1 id="language.variables.scope"> <title>ë³ì ì¬ì© ë²ì (Variable Scope)</title> <simpara> ë³ìê° ì¬ì©ê°ë¥í ê³³ì ê·¸ ë³ìê° ì ì¸ë ê³³ ììì ë§ì´ë¤. PHP ë³ìì ëë¶ë¶ì í ê°ì ë²ì(single scope)ë§ì ê°ì§ê³ ìë¤. ì´ ë²ìë includeë requireëì´ì ì½íì¨ íì¼ìë ëì¼íê² ì ì©ëë¤. ì를ë¤ì´ : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = 1; include "b.inc"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ììì <varname>$a</varname>ë³ìë <filename>b.inc</filename> ì¤í¬ë¦½í¸ììë ì¬ì©í ì ìë¤. 기본ì ì¼ë¡ í¨ì ììì ì ì¸ë ê²ì í¨ì ìììë§ ì¬ì©ëë ì§ì ë³ìì´ë¤. ëí í¨ì ììì ì¬ì©ëë í¨ìë¤ì 기본ì ì¼ë¡ ì§ì ë³ìë¼ê³ ê°ì íê³ ì°¾ê² ëë¤. ì를 ë¤ì´: - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = 1; /* global scope */ Function Test () { @@ -516,16 +222,12 @@ } Test (); - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ì´ ì¤í¬ë¦½í¸ë í¨ì ìì <varname>$a</varname> ë³ì를 ì§ìë³ìë¡ ê°ì íìê³ , ì§ìë³ì $aìë ì무 ê°ë ëì ëì§ ìì기 ë문ì ìë¬´ë° ì¶ë ¥ë ëíëì§ ìëë¤. ì´ê²ì Cìë ì½ê° ì°¨ì´ê° ëë ë¶ë¶ì´ë¤. PHPìì ì ìë³ì를 ì¬ì©íë ¤ë©´ ì¬ì©íê³ ì¶ì ì ì ë³ì를 í¨ì ìì global ì ì¸ì í´ ì£¼ì´ì¼ íë¤. ì를 ë¤ì´ : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = 1; $b = 2; @@ -537,20 +239,15 @@ Sum (); echo $b; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ìì ì¤í¬ë¦½í¸ë "3"ì ì¶ë ¥í ê²ì´ë¤. í¨ì ë´ìì <varname>$a</varname>ì <varname>$b</varname>를 globalë¡ ì ì¸íì¼ë¯ë¡, ì´ í¨ìë´ì $a, $bë ì ì ë³ì를 참조íê² ëë¤. í¨ì ë´ìì ë¤ë£° ì ìë ì ìë³ìì ê°ììë ì íì´ ìë¤. - </simpara> - <simpara> + </simpara> <simpara> ì ì ë³ì를 참조íë ë ë²ì§¸ ë°©ë²ì PHPìì í¹ë³í ì ìíê³ ìë $GLOBALSë¼ë ë°°ì´ì ì¬ì©íë ê²ì´ë¤. ìì ì를 ë¤ìê³¼ ê°ì´ ë°ê¿ ì¸ ì ìë¤. : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = 1; $b = 2; @@ -560,26 +257,18 @@ Sum (); echo $b; - </programlisting> - </informalexample> - <simpara> - <varname>$GLOBALS</varname> ë°°ì´ì ë³ìì´ë¦ì´ Keyê° ëê³ , + </programlisting> </informalexample> <simpara> <varname>$GLOBALS</varname> ë°°ì´ì ë³ìì´ë¦ì´ Keyê° ëê³ , ê·¸ ë³ìì ë´ì©ì´ ê°ì´ ëë ìì를 ê°ì§ associative ë°°ì´ì´ë¤. - </simpara> - <simpara> + </simpara> <simpara> ë³ì ë²ìì ê´ë ¨íì¬ ììëì´ì¼ í ë ë¤ë¥¸ ë´ì©ì¼ë¡ <emphasis>ì ì </emphasis> ë³ì(static variable)ê° ìë¤ë¤. ì ì ë³ìë ì§ì í¨ì ë´ììë§ ì¡´ì¬íì§ë§ ì§ì í¨ìê° ì¢ ë£ëì´ë ê·¸ ê°ì ì½ì´ë²ë¦¬ì§ ìê³ ê°ì§ê³ ìë¤. ë¤ì ì를 ë³´ì : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> Function Test () { $a = 0; echo $a; $a++; } - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> This function is quite useless since every time it is called it sets <varname>$a</varname> to <literal>0</literal> and prints "0". The <varname>$a</varname>++ which increments the @@ -587,30 +276,23 @@ <varname>$a</varname> variable disappears. To make a useful counting function which will not lose track of the current count, the <varname>$a</varname> variable is declared static: - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> Function Test () { static $a = 0; echo $a; $a++; } - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> Now, every time the Test() function is called it will print the value of <varname>$a</varname> and increment it. - </simpara> - <simpara> + </simpara> <simpara> ëí ì ì ë³ìë ë¤ìê³¼ ê°ì´ recursionìì ë°ëì íìíë¤. ì¬ê·ì ì¸ í¨ìë ì기 ìì ì í¨ì를 í¸ì¶íë ê²ì ë§íë¤. ì¬ê·ì ì¸ í¨ì를 ì¬ì©í ëë 무í 루íì ë¹ ì§ ì ì기 ë문ì ë§¤ì° ì£¼ì를 ìíë¤. ë°ë¼ì ì¬ë¬ë¶ì ì¬ê· í¸ì¶ì ëë´ë ì ì í ë°©ë²ì ë§ë ¨í´ ëì´ì¼ íë¤. ë¤ìì ê°ë¨í ìì ë 10ë²ì ì¬ê·ì í¸ì¶ì íë¤. ì ì ë³ì <varname>$count</varname>를 ì¬ì©íì¬ ì¤ë¨ë ì기를 ì ì ìë¤. - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> Function Test () { static $count = 0; @@ -621,50 +303,28 @@ } $count--; } - </programlisting> - </informalexample> - </sect1> - <sect1 id="language.variables.variable"> - <title>ê°ë³ ë³ì (Variable variables)</title> - <simpara> + </programlisting> </informalexample> </sect1> <sect1 id="language.variables.variable"> <title>ê°ë³ ë³ì (Variable variables)</title> <simpara> ê°ë ë³ìì ì´ë¦ì ë³ê²½í ì ìë¤ë©´ í¸ë¦¬íë¤ê³ ëë ëê° ìë¤. ì´ì ë³ìì ì´ë¦ì ë°ê¾¸ì´ ì¬ì©íë ë°©ë²ì ììë³´ì. ë³´íµì ë³ì ì ì¸ì ë¤ìê³¼ ê°ë¤.: - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = "hello"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ê°ë³ ë³ìì ë³ìì ê°ì ê°ì§ ìë ìê³ , ëí ì´ ê°ì ë³ìì ì´ë¦ì¼ë¡ ë¤ë£° ìë ìë¤. ìì ììì $$를 ì¬ì©íë©´ <emphasis>hello</emphasis>ê° ë³ì ì´ë¦ì´ ë ì ìë¤. ì : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $$a = "world"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ì´ë ê² íë©´ PHPì symbol treeìë "hello"ë¼ë ê°ì ê°ì§ë <varname>$a</varname>ì "world"ë¼ë ê°ì ê°ì§ë <varname>$hello</varname>ì ë ê°ì ë³ìê° ìê¸°ê² ëë¤. ê·¸ë¬ë¯ë¡ ë¤ìê³¼ ê°ì 문ì¥ì : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> echo "$a ${$a}"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ë¤ì 문ì¥ê³¼ ë ê°ì ì¶ë ¥ì ëíë´ê² ëë¤.: - </simpara> - <informalexample> - <programlisting> + </simpara> <informalexample> <programlisting> echo "$a $hello"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> i.e. ëì ì¶ë ¥: <computeroutput>hello world</computeroutput>. - </simpara> - <simpara> + </simpara> <simpara> ê°ë³ ë³ì를 ë°°ì´ê³¼ í¨ê» ì¬ì©íë ¤ë©´, íê°ì§ 모í¸ì± 문ì 를 í´ê²°í´ì¼ íë¤. ê·¸ê²ì, ë§ì½ ì¬ë¬ë¶ì´ <varname>$$a[1]</varname>ì´ë¼ê³ ì¼ì¼ë©´, <varname>$a[1]</varname>ì íëì ë³ìë¡ ë³¼ ê²ì¸ì§, @@ -672,51 +332,32 @@ ë¤ìê³¼ ê°ì´ íì¬ ëª¨í¸ì±ì í´ê²°íì. ì ìì ê²½ì° <varname>${$a[1]}</varname>ë¼ê³ ì°ê³ , íìì ê²½ì°ë <varname>${$a}[1]</varname>ë¼ê³ ì°ë©´ ëë¤. ( ìì주: ê°ë³ ë³ì를 ëíë¼ ëë íì { }ë¡ ëë¬ ì¸ë ê²ì´ 보기 ì¢ê³ ì¤ë¥ë ìì¨ ì ìë¤.) - </simpara> - </sect1> - <sect1 id="language.variables.external"> - <title>PHP ë°ìì ì¨ ë³ìë¤ (Variables from outside PHP)</title> - <sect2 id="language.variables.external.form"> - <title>HTML Forms (GET and POST)</title> - <simpara> + </simpara> </sect1> <sect1 id="language.variables.external"> <title>PHP ë°ìì ì¨ ë³ìë¤ (Variables from outside PHP)</title> <sect2 id="language.variables.external.form"> <title>HTML Forms (GET and POST)</title> <simpara> í¼ì´ PHP ì¤í¬ë¦½í¸ë¡ submitëë©´ í¼ì ìë 모ë ë´ì©ë¤ì´ ìëì ì¼ë¡ ë§ë¤ì´ì§ PHP ë³ìë¡ ë¤ì´ì¨ë¤. ë§ì½ <link linkend="ini.track-vars">track_vars</link> ìµì ì´ onì¼ë¡ ì¤ì ëì´ ìì¼ë©´, ì´ ë³ìë¤ ëª¨ëë ê·¸ê²ì´ ì´ëì ë§ë¤ì´ì§ ê²ì´ëì ë°ë¼ì <varname>$HTTP_POST_VARS</varname>, <varname>$HTTP_GET_VARS</varname>, <varname>$HTTP_POST_FILES</varname>ì associative ë°°ì´ì ìì¹íê² ëë¤. - </simpara> - <para> + </simpara> <para> ì´ ë³ììëí ìì¸í ì¤ëª ì <link linkend="language.variables.predefined">미리 ì ìë ë³ì (Predefined variables)</link>ì ì½ì´ë³´ê¸° ë°ëë¤. - </para> - <para> - <example> - <title>Simple form variable</title> - <programlisting role="php"> + </para> <para> <example> <title>Simple form variable</title> <programlisting role="php"> <form action="foo.php" method="post"> Name: <input type="text" name="username"><br> <input type="submit"> </form> - </programlisting> - </example> - </para> - <para> + </programlisting> </example> </para> <para> When the above form is submitted, the value from the text input will be available in <varname>$HTTP_POST_VARS['username']</varname>. If the <link linkend="ini.register-globals">register_globals</link> configuration directive is turned on, then the variable will also be available as <varname>$username</varname> in the global scope. - </para> - <simpara> + </para> <simpara> PHP also understands arrays in the context of form variables. You may, for example, group related variables together, or use this feature to retrieve values from a multiple select input: - </simpara> - <para> - <example> - <title>More complex form variables</title> - <programlisting role="php"> + </simpara> <para> <example> <title>More complex form variables</title> <programlisting role="php"> <form action="array.php" method="post"> Name: <input type="text" name="personal[name]"><br> Email: <input type="text" name="personal[email]"><br> @@ -728,34 +369,19 @@ </select> <input type="submit"> </form> - </programlisting> - </example> - </para> - <para> + </programlisting> </example> </para> <para> In PHP 3, the array form variable usage is limited to single-dimensional arrays. In PHP 4, no such restriction applies. - </para> - <sect3 id="language.variables.external.form.submit"> - <title>IMAGE SUBMITì ë³ì ì´ë¦</title> - <simpara> + </para> <sect3 id="language.variables.external.form.submit"> <title>IMAGE SUBMITì ë³ì ì´ë¦</title> <simpara> í¼ì submití ë ì¼ë°ì ì¼ë¡ ì¬ì©íë submit ë²í¼ ëì ë¤ìê³¼ ê°ì´ 그림ì ì¬ì©í ìë ìë¤. : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> <input type=image src="image.gif" name="sub"> - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ì¬ì©ìê° image를 í´ë¦íë©´, í¼ì sub_xì sub_yì ë ê°ì ë³ìê° ì¶ê°ëì´ ìë²ì ì ì¡ëë¤. ì´ ë ë³ìë ì´ë¯¸ì§ìì ì¬ì©ìê° clickí ìì¹ ì 보를 ë´ê³ ìë¤. ì¼ë¶ ë¸ë¼ì°ì ììë ë°ì¤(_)ëì ë§ì¹¨í(.)를 ì¬ì©íë ê²½ì°ë ìëë°, PHPë ì´ë° ê²½ì° ìëì ì ë§ì¹¨í(.)를 ë°ì¤(_)ë¡ ë°ê¿ì¤ë¤. - </simpara> - </sect3> - </sect2> - <sect2 id="language.variables.external.cookies"> - <title>HTTP Cookies</title> - <simpara> + </simpara> </sect3> </sect2> <sect2 id="language.variables.external.cookies"> <title>HTTP Cookies</title> <simpara> PHPë HTTP ì¿ í¤ë¥¼ <ulink url="&spec.cookies;">Netscape's Spec</ulink>ì ì ìì ë°ë¼ ì ê³µíë¤. Cookie ë©ì¹´ëì¦ì í¸ëí¹ì´ë ì¬ì©ì ìë³ ë±ì ìí´ ì격 browserì ì ì¥ë ë°ì´í°ë¥¼ ëë ¤ ë°ë ê³¼ì ì ë§íë¤. ì¬ë¬ë¶ì cookie를 ì¤ì í기 ìí´ <function>SetCookie</function>í¨ì를 ì¬ì©í ì ìë¤. @@ -763,52 +389,31 @@ í¨ìë ë¸ë¼ì°ì ë¡ ë³´ë´ë ì´ë¤ ë°ì´í°ë³´ë¤ë ìì ì¬ì©í´ì¼ íë¤. ì´ ì ì½ì <function>Header</function> í¨ìì ê°ì ì ì½ì¼ë¡ ë³´ë©´ ëë¤. ë³´ë¸ ëª¨ë cookieë ìëì ì¼ë¡ GETì´ë POST ë°©ì ë°ì´í°ì ê°ì PHP ë³ìë¡ ë³íëë¤. - </simpara> - <simpara> + </simpara> <simpara> ë§ì½ ì¬ë¬ë¶ì´ ëì¼í cookieì ì¬ë¬ ê°ì ì ì¥íê³ ì¶ë¤ë©´ Cookieì´ë¦ì <emphasis>[]</emphasis>를 ëíë©´ ëë¤. ì를 ë¤ì´ : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> SetCookie ("MyCookie[]", "Testing", time()+3600); - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ì¿ í¤ë ìë¡ ì¤ì íë©´ pathë ëë©ì¸ì´ ë¤ë¥´ì§ ìë í ì´ì ì ì¿ í¤ë¥¼ ë®ì´ì°ê² ëë¤. ê·¸ë¬ë¯ë¡ ì¼í ì¹´í¸ ê°ì ìì© íë¡ê·¸ë¨ììë ë¤ìê³¼ ê°ì´ ì¹´ì´í°ë¥¼ ì¬ì©íì¬, ì´ê²ì 기ì¤ì¼ë¡ Cookie를 ì¬ì©íë ê²ì´ ì¢ë¤. ì : - </simpara> - <example> - <title>SetCookie Example</title> - <programlisting role="php"> + </simpara> <example> <title>SetCookie Example</title> <programlisting role="php"> $Count++; SetCookie ("Count", $Count, time()+3600); SetCookie ("Cart[$Count]", $item, time()+3600); - </programlisting> - </example> - </sect2> - <sect2 id="language.variables.external.environment"> - <title>íê²½ ë³ì (Environment variables)</title> - <para> + </programlisting> </example> </sect2> <sect2 id="language.variables.external.environment"> <title>íê²½ ë³ì (Environment variables)</title> <para> PHPë ìëì ì¼ë¡ íê²½ ë³ìë¤ì ì¼ë°ì ì¸ PHP ë³ìë¡ ë§ë ë¤. - <informalexample> - <programlisting role="php"> + <informalexample> <programlisting role="php"> echo $HOME; /* Shows the HOME environment variable, if set. */ - </programlisting> - </informalexample> - </para> - <para> + </programlisting> </informalexample> </para> <para> GET, POST, Cookie ë©ì¹´ëì¦ì íµí´ì ë¤ì´ ì¨ ì ë³´ë¡ë¶í°ë PHP ë³ìê° ì기ë¯ë¡, ëëë¡ íê²½ë³ìë¡ë¶í° ë°ìê²ì´ íì¤íê°ë¥¼ íì¸í íìê° ìì ëë ìë¤. ì´ë¥¼ ìí´ <function>getenv</function> í¨ì를 ì¬ì©íë¤. íê²½ ë³ì를 ì¤ì í기 ìí´ìë <function>putenv</function> í¨ì를 ì¬ì©íë¤. - </para> - </sect2> - <sect2 id="language.variables.external.dot-in-names"> - <title>ì¸ë¶ ë³ìëª ì ìë '.' (Dots in incoming variable names)</title> - <para> + </para> </sect2> <sect2 id="language.variables.external.dot-in-names"> <title>ì¸ë¶ ë³ìëª ì ìë '.' (Dots in incoming variable names)</title> <para> ì¼ë°ì ì¼ë¡ PHPë ë³ì를 ì¤í¬ë¦½í¸ë¡ ê°ì ¸ì¬ ë ë³ìëª ì ë°ê¾¸ì§ ìëë¤. ê·¸ë¬ë, PHPì ë³ìëª ìë '.' (ì )ì ì¬ì©í ì ìë¤. ë¤ìê³¼ ê°ì ê²½ì°ë¥¼ ë³´ì. : <programlisting role="php"> @@ -817,25 +422,16 @@ ìì ê²½ì° PHP íìë <varname>$varname</varname>ì´ë¼ë ë³ìì, ì°ê²° ì°ì°ì, 'ext'(ë°ì´íê° ìë ê²½ì° ê·¸ê²ì´ ì´ë¤ ìë ¤ì§ í¤ë ìì½ì´ê° ìëë©´ 문ìì´ë¡ ì·¨ê¸ëë¤.)ë¡ í´ìíë¤. ì´ê²ì ì°ë¦¬ê° ìíë ê²°ê³¼ê° ìëë¤. - </para> - <para> + </para> <para> ìì ê°ì ì´ì ë¡ PHPë ì¸ë¶ìì ë¶ë¬ë¤ì¸ ë³ìì ì´ë¦ì '.'ì´ ìì¼ë©´ '_'(ë°ì¤)ë¡ ë°ê¾¸ì´ ì½ì´ë¤ì¸ë¤. - </para> - </sect2> - <sect2 id="language.variables.determining-type-of"> - <title>ë³ìì Type íë¨ (Determining variable types)</title> - <para> + </para> </sect2> <sect2 id="language.variables.determining-type-of"> <title>ë³ìì Type íë¨ (Determining variable types)</title> <para> PHPë ë³ìì typeì ììì ì íê³ (ì¼ë°ì ì¼ë¡) íìí ê²½ì°ìë ê·¸ typeì ë°ê¾¸ë¯ë¡, í¹ì ìì ì ê·¸ ë³ì ì´ë¤ typeì¸ì§ë ì½ê² ì ì ìë¤. PHPë ë³ìì typeì ìì보기 ìí´ ì¬ë¬ê°ì í¨ì를 ê°ì§ê³ ìë¤. <function>gettype</function>, <function>is_long</function>, <function>is_double</function>, <function>is_string</function>, <function>is_array</function>, <function>is_object</function> ê° ê·¸ê²ë¤ì´ë¤. - </para> - </sect2> - </sect1> -</chapter> -<!-- Keep this comment at the end of the file + </para> </sect2> </sect1></chapter><!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t @@ -850,4 +446,4 @@ sgml-local-catalogs:nil sgml-local-ecat-files:nil End: - --> + -->ÿ \ No newline at end of file
Index: phpdoc/kr/language/references.xml diff -u phpdoc/kr/language/references.xml:1.3 phpdoc/kr/language/references.xml:1.4 --- phpdoc/kr/language/references.xml:1.3 Fri Jan 12 06:16:40 2001 +++ phpdoc/kr/language/references.xml Mon Jan 29 18:25:41 2001 @@ -1,293 +1,118 @@ - <chapter id="language.references"> - <title>References Explained</title> - - <sect1 id="language.references.whatare"> - <title>What References Are</title> - <simpara> - References are a means in PHP to access the same variable content - by different names. They are not like C pointers, they are symbol - table aliases. Note that in PHP, variable name and variable content - are different, so the same content can have different names. - The most close analogy is with Unix filenames and files - - variable names are directory entries, while variable contents is - the file itself. References can be thought of as hardlinking in - Unix filesystem. - </simpara> - </sect1> - - <sect1 id="language.references.whatdo"> - <title>What References Do</title> - <para> - PHP references allow you to make two variables to refer to the - same content. Meaning, when you do: - <informalexample> - <programlisting role="php"> -$a =& $b - </programlisting> - </informalexample> - it means that <varname>$a</varname> and <varname>$b</varname> - point to the same variable. - <note> - <para> - <varname>$a</varname> and <varname>$b</varname> are completely - equal here, that's not <varname>$a</varname> is pointing to - <varname>$b</varname> or vice versa, that's - <varname>$a</varname> and <varname>$b</varname> pointing to the - same place. - </para> - </note> - </para> - <para> - The same syntax can be used with functions, that return references, - and with <literal>new</literal> operator (in PHP 4.0.4 and later): - <informalexample> - <programlisting role="php"> -$bar =& new fooclass(); -$foo =& find_var ($bar); - </programlisting> - </informalexample> - </para> - <note> - <para> - Unless you use the syntax above, the result of - <literal>$bar = new fooclass()</literal> will not be the same - variable as <literal>$this</literal> in the constructor, meaning - that if you have used reference to <literal>$this</literal> in - the constructor, you should use reference assignment, or you get - two different objects. - </para> - </note> - <para> - The second thing references do is to pass variables - by-reference. This is done by making a local variable in a function and - a variable in the calling scope reference to the same content. Example: - <informalexample> - <programlisting role="php"> -function foo (&$var) { - $var++; -} - -$a=5; -foo ($a); - </programlisting> - </informalexample> - will make <varname>$a</varname> to be 6. This happens because in - the function <varname>foo</varname> the variable - <varname>$var</varname> refers to the same content as - <varname>$a</varname>. See also more detailed explanations about <link - linkend="language.references.pass">passing by reference</link>. - </para> - <simpara> - The third thing reference can do is <link - linkend="language.references.return">return by reference</link>. - </simpara> - </sect1> - - <sect1 id="language.references.arent"> - <title>What References Are Not</title> - <para> - As said before, references aren't pointers. That means, the - following construct won't do what you expect: - <informalexample> - <programlisting role="php"> -function foo (&$var) { - $var =& $GLOBALS["baz"]; -} -foo($bar); - </programlisting> - </informalexample> - </para> - <simpara> - What happens is that <varname>$var</varname> in foo will be bound - with <varname>$bar</varname> in caller, but then it will be - re-bound with <varname>$GLOBALS["baz"]</varname>. There's no way - to bind <varname>$bar</varname> in the calling scope to something else - using the reference mechanism, since <varname>$bar</varname> is not - available in the function foo (it is represented by - <varname>$var</varname>, but <varname>$var</varname> has only - variable contents and not name-to-value binding in the calling - symbol table). - </simpara> - </sect1> - - <sect1 id="language.references.pass"> - <title>Passing by Reference</title> - <para> - You can pass variable to function by reference, so that function could modify - its arguments. The sytax is as follows: - <informalexample> - <programlisting role="php"> -function foo (&$var) { - $var++; -} - -$a=5; -foo ($a); -// $a is 6 here - </programlisting> - </informalexample> - Note that there's no reference sign on function call - only on - function definition. Function definition alone is enough to - correctly pass the argument by reference. - </para> - <para> - Following things can be passed by reference: - <itemizedlist> - <listitem> - <simpara> - Variable, i.e. <literal>foo($a)</literal> - </simpara> - </listitem> - <listitem> - <simpara> - New statement, i.e. <literal>foo(new foobar())</literal> - </simpara> - </listitem> - <listitem> - <para> - Reference, returned from a function, i.e.: - <informalexample> - <programlisting role="php"> -function &bar() -{ - $a = 5; - return $a; -} -foo(bar()); - </programlisting> - </informalexample> - See also explanations about <link - linkend="language.references.return">returning by reference</link>. - </para> - </listitem> - </itemizedlist> - </para> - <para> - Any other expression should not be passed by reference, as the - result is undefined. For example, the following examples of passing - by reference are invalid: - <informalexample> - <programlisting role="php"> -function bar() // Note the missing & -{ - $a = 5; - return $a; -} -foo(bar)); - -foo($a = 5) // Expression, not variable -foo(5) // Constant, not variable - </programlisting> - </informalexample> -These requirements are for PHP 4.0.4 and later. - </para> - </sect1> - - <sect1 id="language.references.return"> - <title>Returning References</title> - <para> - Returning by-reference is useful when you want to use a function - to find which variable a reference should be bound to. When - returning references, use this syntax: - <informalexample> - <programlisting role="php"> -function &find_var ($param) { - ...code... - return $found_var; -} - -$foo =& find_var ($bar); -$foo->x = 2; - </programlisting> - </informalexample> - In this example, the property of the object returned by the - <varname>find_var</varname> function would be set, not the - copy, as it would be without using reference syntax. - </para> - <note> - <simpara> - Unlike parameter passing, here you have to use - <literal>&</literal> in both places - to indicate that you - return by-reference, not a copy as usual, and to indicate that - reference binding, rather than usual assignment, should be done - for <varname>$foo</varname>. - </simpara> - </note> - </sect1> - - <sect1 id="language.references.unset"> - <title>Unsetting References</title> - <para> - When you unset the reference, you just break the binding between - variable name and variable content. This does not mean that - variable content will be destroyed. For example: - <informalexample> - <programlisting role="php"> -$a = 1; -$b =& $a; -unset ($a); - </programlisting> - </informalexample> - won't unset <varname>$b</varname>, just <varname>$a</varname>. - </para> - <simpara> - Again, it might be useful to think about this as analogous to Unix - <command>unlink</command> call. - </simpara> - </sect1> - - <sect1 id="language.references.spot"> - <title>Spotting References</title> - <simpara> - Many syntax constructs in PHP are implemented via referencing - mechanisms, so everything told above about reference binding also - apply to these constructs. Some constructs, like passing and - returning by-reference, are mentioned above. Other constructs that - use references are: - </simpara> - - <sect2 id="references.global"> - <title><literal>global</literal> References</title> - <para> - When you declare variable as <command>global $var</command> you - are in fact creating reference to a global variable. That means, - this is the same as: - <informalexample> - <programlisting role="php"> -$var =& $GLOBALS["var"]; - </programlisting> - </informalexample> - </para> - <simpara> - That means, for example, that unsetting <varname>$var</varname> - won't unset global variable. - </simpara> - </sect2> - - <sect2 id="references.this"> - <title><literal>$this</literal></title> - <simpara> - In an object method, <varname>$this</varname> is always reference - to the caller object. - </simpara> - </sect2> - </sect1> - - </chapter> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -sgml-parent-document:nil -sgml-default-dtd-file:"../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: ---> +<!-- edited with XML Spy v3.0.7 NT (http://www.xmlspy.com) by panda (bra) --><chapter id="language.references"> <title>References Explained</title> <sect1 id="language.references.whatare"> <title>참조(Reference)ë 무ìì¸ê°.</title> <simpara> + 참조ë PHPìì ëì¼í ê°ì ìë¡ë¤ë¥¸ ì´ë¦ì¼ë¡ access íë ê²ì ë§íë¤. + 참조ë Cì¸ì´ ììì pointerìë 구ë³ëë©°, simbol tableê³¼ ê°ë¤ê³ í ì ìë¤. PHP + ììë ë³ìëª ê³¼ ë³ìê°ì´ ë¤ë¥´ë¤ëê²ì 주ì í´ì¼ íë¤. ë°ë¼ì, ëì¼í + ë´ì©ì´ ë¤ë¥¸ ì´ë¦ì ê°ì§ì ìë¤. ì´ë ë³ìê°ì´ íì¼ì´ì§ë§ ë³ìëª ì + ëë í 리ì ììì¸ UNIXìì fileê³¼ filenameê³¼ì ê´ê³ì 매ì°ì ì¬íë¤. + 참조ë UNIX íì¼ ìì¤í ììì hardlinkingì¼ë¡ ìê°í ì ìë¤. + </simpara> </sect1> <sect1 id="language.references.whatdo"> <title>ì°¸ì¡°ë¡ í ì ìëì¼ì(What References Do)</title> <para> + 첫ë²ì§¸ë¡ PHPììì 참조ë ëê°ì ë¤ë¥¸ ë³ìê° ëì¼í ë´ì©(content)를 + ê°ë¦¬í¬ì ìê² íë¤. ë¤ìë§í´ ë¤ìê³¼ ê°ì 문ì¥ì´ ìë¤ë©´ + <informalexample> <programlisting role="php"> +$a =& $b + </programlisting> </informalexample> + ì´ë +<varname>$a</varname> ì<varname>$b</varname> + ë ëì¼í ë³ìë¼ê³ í ì ìë¤ <note> <para> <varname>$a</varname> ì<varname>$b</varname> ë ì´ ë¬¸ì¥ììë ìë²½íê² ëì¼í ë³ìì´ì§ë§,<varname>$a</varname> ê° <varname>$b</varname> 를 ê°ë¦¬í¨ë¤. ì´ë ë¤ìë§í´ <varname>$a</varname> ì<varname>$b</varname> ë ëì¼í ìì¹ì ë´ì©(content)를 ì§ì¹íê³ ìë¤. + </para> </note> </para> <para> + í¨ìììë ë³ììì ì ì©ëë ê²ê³¼ ëì¼íê² ì ì©ëë¤. <literal>new</literal> ë¼ë ì°ì°ì를 ì¬ì©íì¬ ì°¸ì¡°ë¥¼ ëë ¤ì¤ì ìë¤.(ì´ë PHP 4.0.4ì´í ë²ì ¼ì ì ì©ëë¤.) <informalexample> <programlisting role="php"> +$bar =& new fooclass(); +$foo =& find_var ($bar); + </programlisting> </informalexample> </para> <note> <para> + Unless you use the syntax above, the result of + <literal>$bar = new fooclass()</literal> will not be the same + variable as <literal>$this</literal> in the constructor, meaning + that if you have used reference to <literal>$this</literal> in + the constructor, you should use reference assignment, or you get + two different objects. + </para> </note> <para> ì°¸ì¡°ë¡ í ì ìë ëë²ì§¸ ê²ì 참조ì ìí ë³ìì ì ë¬ì´ë¤. ì´ë í¨ì ë´ìì ìì±ë ì§ìë³ìì í¨ì를 í¸ì¶í ììì ë³ìê° ëì¼í ê°ì ê°ë¦¬í¤ê² í ì ìë¤. + ìëì ì를 ë³´ì<informalexample> <programlisting role="php"> +function foo (&$var) { + $var++; +} + +$a=5; +foo ($a); + </programlisting> </informalexample><varname>$a</varname> ì ê°ì 6ì´ ëë¤. ì´ë í¨ì<varname>foo</varname> ë´ì ì§ìë³ì <varname>$var</varname> ê° í¨ì를 í¸ì¶í ììì ë³ì <varname>$a</varname>ì ëì¼í ê°(content)ì 참조í기 ë문ì´ë¤. ì´ì ëí ì¢ ë ìì¸í ì¤ëª ì<link linkend="language.references.pass">참조ì ìí ì ë¬(passing by reference)</link>ì íì¸í´ 보기 ë°ëë¤. + </para> <simpara> ì¸ë²ì§¸ë¡ 참조ë¡ì í ì ìë ê²ì<link linkend="language.references.return">참조ì ìí return(return by reference)</link>ì´ë¤. + </simpara> </sect1> <sect1 id="language.references.arent"> <title>참조를 ì¬ì©í¨ì ìì´ ì£¼ì í´ì¼ í ê²(What References Are Not)</title> <para> ìì ë§íë¯ì´ 참조ë C ì¸ì´ììì pointerìë ë¤ë¥´ë¤. ìëì ì를 ë³´ê³ ê·¸ ê²°ê³¼ê° ì°ë¦¬ê° 기ëíë ê²ê³¼ ë¤ë¥´ë¤ë ê²ì ìë¤ë©´ 참조(reference)ì pointerê° ë¤ë¥´ë¤ë ê²ì ìì ìì ê²ì´ë¤. + <informalexample> <programlisting role="php"> +function foo (&$var) { + $var =& $GLOBALS["baz"]; +} +foo($bar); + </programlisting> </informalexample> </para> <simpara> ìì ììì fooí¨ì ë´ì ë³ì<varname>$var</varname> ë í¨ì를 í¸ì¶í ììì ë³ì<varname>$bar</varname> ì ëì¼í ê°ì 참조íì§ë§ ê³§ì´ì´ ì ìë³ì<varname>$GLOBALS["baz"]</varname>ê° ì°¸ì¡°íë ê°ì 참조íëë¡ ë°ëë¤. ì´ì ì´ í¨ìë´ìì 참조ì ë©ì¹´ëì¦ì ì¬ì©íì¬ í¨ì를 í¸ì¶í ììì ë³ì<varname>$bar</varname> 를 참조í ì ìë ë°©ë²ì´ ìë¤. ë°ë¼ì í¨ì를 í¸ì¶í ììì ë³ì<varname>$bar</varname> ë í¨ì fooë´ììë 무ì 미í ì ë°ì ìë¤. (ì¦ í¨ì를 í¸ì¶í ììì ë³ìë í¨ìë´ì ë³ì<varname>$var</varname>ì ìí´ ëíë¼ì ìì§ë§,<varname>$var</varname> ë ë¨ì§ ë³ìê°ì´ì§ symbol tableì ì ìë ë³ìëª ì´ ìëë¤.) </simpara> </sect1> <sect1 id="language.references.pass"> <title>참조를 ì¬ì©í ì ë¬(Passing by Reference)</title> <para> 참조(reference)를 ì¬ì©íì¬ ë³ì를 í¨ìë¡ ë겨 ì ë¬(pass)í ì ìë¤. ê·¸ëì í¨ì ë´ìì ë³ìì ê°ì ìì í ì ìë¤. ë¤ìì´ ê·¸ ìì´ë¤.<informalexample> <programlisting role="php"> +function foo (&$var) { + $var++; +} + +$a=5; +foo ($a); +// $a is 6 here + </programlisting> </informalexample> í¨ì를 í¸ì¶í ë 참조를 ì´ì©íì¬ ë³ì를 ì ë¬(pass)íë¤ë ì´ë í íìë ìë¤ë ê²ì 주ìíì. ë¨ì§ í¨ì를 ì ì í ë ë³ì를 참조ì ìí´ ì ë¬ ë°ëë¤ë íìê° ìë¤. í¨ì를 ì ìí ë ì´ë¥¼ ì ì í¨ì¼ë¡ì¨ 참조ì ìí ë³ì ì ë¬ì´ ê°ë¥íë¤. </para> <para> 참조ì ìí´ ë³ì를 ë겨 주ë ë°©ë²ì ë¤ìì ì¸ê°ì§ ë°©ë²ì´ ìë¤: <itemizedlist> <listitem> <simpara> ë³ìì ìí ë°©ë², ì¦.<literal>foo($a)</literal> </simpara> </listitem> <listitem> <simpara> Newë¼ë 문ì¥ì ì´ì©íë ë°©ë², ì¦.<literal>foo(new foobar())</literal> </simpara> </listitem> <listitem> <para> í¨ìë¡ ë¶í° ë겨 ë°ë 참조ì ìí ë°©ë², ì¦. <informalexample> <programlisting role="php"> +function &bar() +{ + $a = 5; + return $a; +} +foo(bar()); + </programlisting> </informalexample><link linkend="language.references.return">참조ì ìí 리í´(returning by reference)</link>ì ìì¸í ì¤ëª ì ë³¼ì ìë¤. + </para> </listitem> </itemizedlist> </para> <para> ìì ëì´í ì¸ê°ì§ ë°©ë²ì¸ìë 참조ì ìí ì ë¬(pass)ì í ì ìë¤. ì를 ë¤ë©´ ìë ìì ê°ì ë°©ë²ì¼ë¡ 참조ì ìí ì ë¬ì ê·¸ ìë¯¸ê° ê·¸ ìë¯¸ê° ì ííì§ ëª»íë¤.<informalexample> <programlisting role="php"> +function bar() // & ê° ë¹ ì ¸ììì ì ìíì; +{ + $a = 5; + return $a; +} +foo(bar)); + +foo($a = 5) // ííì(Expression)ì ë³ìê° ìëë¤. +foo(5) // ìì(Constant)ë ë³ìê° ìëê°. + </programlisting> </informalexample> ì´ ëª¨ë ê²ì PHP 4.0.4 ì´ìì ë²ì ¼ì í´ë¹ëë¤. </para> </sect1> <sect1 id="language.references.return"> <title>ì°¸ì¡°ê° ë¦¬í´(Returning References)</title> <para> ì°¸ì¡°ê° ë¦¬í´ì ë³ìê° ì´ë¤ê°ì 참조íë ì§ë¥¼ ì°¾ë í¨ì를 ì¬ì©í ë ì ì©íë¤. ì°¸ì¡°ê° ë¦¬í´ì 문ë²ì ë¤ìê³¼ ê°ë¤<informalexample> <programlisting role="php"> +function &find_var ($param) { + ...code... + return $found_var; +} + +$foo =& find_var ($bar); +$foo->x = 2; + </programlisting> </informalexample> ìì ììì í¨ì<varname>find_var</varname>ì ìí´ ë¦¬í´ë ê°ì²´ì ìì±ì ë³µì¬ëì´ ì§ë ê²ì´ ìëë¼ ì ì(set)ëì´ ì§ë¤.참조ì 문ë²ì ì¬ì©íì§ ìê³ ë ê°ë¥íë¤.</para> <note> <simpara> ì°¸ì¡°ê° ë¦¬í´ ì´ë¼ë ê²ì íì í기ìí´ ì¸ìì ë¬ê³¼ë ë¬ë¦¬ í¨ì를 í¸ì¶íë 쪽과 í¸ì¶ëì´ì§ë í¨ì ì쪽ì <literal>&</literal>기í¸ê° ìì´ì¼ íë¤. ì´ë¡ ì¸í´ ì¼ë°ì ì¼ë¡ í¨ìê°ì 리í´ë°©ìì¸ ë³µì¬ì ìí ë°©ë²ì´ ìëë¼ ì°¸ì¡°ë¥¼ ì¬ì©í 리í´ì´<varname>$foo</varname>ë¡ ê°ë¥í´ ì§ ê²ì´ë¤. + </simpara> </note> </sect1> <sect1 id="language.references.unset"> <title>참조ì§ì ìì 기(Unsetting References)</title> <para> 참조ë ê°ì ìì ë ¤ë©´ ë³ìëª ê³¼ ê·¸ê° ê°ë¦¬í¤ë ë´ì©(content)ìì ì°ê²°ê³ 리를 ëì¼ë©´ ëë¤. ì´ë ê² íë¤ê³ í´ì ë³ìê° ê°ë¦¬í¤ë ë´ì© ìì²´ê° ìì´ì§ë¤ë ê²ì ì미íì§ë ìëë¤. ìëì ì를 ë³´ì: + <informalexample> <programlisting role="php"> +$a = 1; +$b =& $a; +unset ($a); + </programlisting> </informalexample> ë³ì<varname>$b</varname>ì 참조ë ê°ì ìì¤ê²ì´ ìëë¼ ë¨ì§ ë³ì<varname>$a</varname>ê° ì§ìíë ê²ì ìì´ë¤. + </para> <simpara> ë¤ìë§í´, ì´ë Unix ìì¤í ìì <command>unlink</command>를 í¸ì¶íë ê²ê³¼ ìë¹í ì ì¬íë¤. </simpara> </sect1> <sect1 id="language.references.spot"> <title>Spotting References</title> <simpara> + Many syntax constructs in PHP are implemented via referencing + mechanisms, so everything told above about reference binding also + apply to these constructs. Some constructs, like passing and + returning by-reference, are mentioned above. Other constructs that + use references are: + </simpara> <sect2 id="references.global"> <title> <literal>global</literal> References</title> <para> + When you declare variable as <command>global $var</command> you + are in fact creating reference to a global variable. That means, + this is the same as: + <informalexample> <programlisting role="php"> +$var =& $GLOBALS["var"]; + </programlisting> </informalexample> </para> <simpara> + That means, for example, that unsetting <varname>$var</varname> + won't unset global variable. + </simpara> </sect2> <sect2 id="references.this"> <title> <literal>$this</literal> </title> <simpara> + In an object method, <varname>$this</varname> is always reference + to the caller object. + </simpara> </sect2> </sect1></chapter><!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +--> \ No newline at end of file Index: phpdoc/kr/language/variables.xml diff -u phpdoc/kr/language/variables.xml:1.1 phpdoc/kr/language/variables.xml:1.2 --- phpdoc/kr/language/variables.xml:1.1 Tue Jan 9 00:23:41 2001 +++ phpdoc/kr/language/variables.xml Mon Jan 29 18:25:41 2001 @@ -1,64 +1,22 @@ -<chapter id="language.variables"> - <title>ë³ì (Variables)</title> - <sect1 id="language.variables.basics"> - <title>기본(Basics)</title> - <simpara> - Variables in PHP are represented by a dollar sign followed by the - name of the variable. The variable name is case-sensitive. - </simpara> - <para> - Variable names follow the same rules as other labels in PHP. A - valid variable name starts with a letter or underscore, followed - by any number of letters, numbers, or underscores. As a regular - expression, it would be expressed thus: - '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' - </para> - <note> - <simpara> - For our purposes here, a letter is a-z, A-Z, and the ASCII - characters from 127 through 255 (0x7f-0xff). - </simpara> - </note> - <para> - <informalexample> - <programlisting role="php"> +<!-- edited with XML Spy v3.0.7 (http://www.xmlspy.com) by panda (bra) --><chapter id="language.variables"> <title>ë³ì (Variables)</title> <sect1 id="language.variables.basics"> <title>기본(Basics)</title> <simpara> PHPìì ë³ìë ì´ë¦ìì ë¬ë¬íì($)를 ë¶ì¬ì ì¬ì©íë¤. ëí ë³ìëª ì ìì´ ëì문ìë 구ë¶íë¤. </simpara> <para> ë³ìëª ì PHPë´ì ë¤ë¥¸ ë¼ë²¨ëª ì ì ìíë ê²ê³¼ ëì¼í ê·ì¹ì ì ì© ë°ëë¤. ì í¨í ë³ìëª ì 문ìë í¹ì ì¸ëì¤ì½ì(_)ë¡ ììíì¬ì¼ íê³ , ëë²ì§¸ 문ìë¶í°ë 문ìë ì«ì,ì¸ëì¤ì½ìë±ì ì¬ì©í ì ìê³ ê¸¸ì´ìë ì íì´ ìë¤. ì ê·ìì¼ë¡ íííìë©´ ë¤ìê³¼ ê°ì´ ëíë¼ì ìë¤. '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' + </para> <note> <simpara> + a-z, A-Z ì¬ì´ì ìí벳과 ASCII code 127ë¶í° 255ê¹ì§ë¥¼ ì미íë¤ (0x7f-0xff). + </simpara> </note> <para> <informalexample> <programlisting role="php"> $var = "Bob"; $Var = "Joe"; -echo "$var, $Var"; // outputs "Bob, Joe" +echo "$var, $Var"; // ê²°ê³¼ê°ì "Bob, Joe" -$4site = 'not yet'; // invalid; starts with a number -$_4site = 'not yet'; // valid; starts with an underscore -$t㸴e = 'mansikka'; // valid; '⥠is ASCII 228. - </programlisting> - </informalexample> - </para> - <para> - In PHP 3, variables are always assigned by value. That is to say, - when you assign an expression to a variable, the entire value of - the original expression is copied into the destination - variable. This means, for instance, that after assigning one - variable's value to another, changing one of those variables will - have no effect on the other. For more information on this kind of - assignment, see <link linkend="language.expressions">Expressions</link>. - </para> - <para> - PHP 4 offers another way to assign values to variables: - <emphasis>assign by reference</emphasis>. This means that the new - variable simply references (in other words, "becomes an alias for" - or "points to") the original variable. Changes to the new variable - affect the original, and vice versa. This also means that no - copying is performed; thus, the assignment happens more - quickly. However, any speedup will likely be noticed only in tight - loops or when assigning large arrays or objects. - </para> - <para> +$4site = 'not yet'; // ë³ìëª ì´ ì«ìë¡ ììíì¼ë¯ë¡ ê·ì¹ì ìë°°ëë¤ +$_4site = 'not yet'; // ì¸ëì¤ì½ìë¡ ììë ë³ìë ì¬ì©í ì ìë¤. +$t_e = 'mansikka'; // '_ë ASCII 228ë²ì§¸ 문ìì´ë¯ë¡ ì í¨íë¤. + </programlisting> </informalexample> </para> <para> PHP 3 ìì ë³ìë íì ê°ì ê°ì§ê³ ìë¤. ì´ë ë¤ìë§í´ì, ííìì ê°ì ë³ìì ì ì©íë©´ ííìì ê²°ê³¼ê°ì´ ë³ìë¡ ë³µì¬ëë¤. ííìì ê°ì ë³ìì ë³µì¬íë¯ë¡ ë³µì¬ëê³ ë íì ííìì ë³íë ë³ìì ëì´ì ìí¥ì ì£¼ì§ ìëë¤ê³ í ì ìë¤. ì´ì ëí ìì¸í ì¤ëª ì <link linkend="language.expressions">ííì(Expressions)</link>ì 참조í기 ë°ëë¤. + </para> <para> PHP 4 ììë ë³ìì ê°ì ì§ì íë ë¤ë¥¸ ë°©ë²ì ì ìíê³ ìë¤: <emphasis>참조(reference)를 ì¬ì©í ê° ì§ì (assign)</emphasis>. ì´ë ìë¡ì´ ë³ìê° ê°ì ë³µì¬íì¬ ê°ì§ê³ ì¤ë ê²ì´ ìëë¼ ìë ê°ì´ ìë ê³³ì ë¨ìí 참조íë ë°©ë²ì´ë¤. ìë ê°ì´ ìë ë³ìì ë³ì¹ì´ ëë¤ë¼ê³ í ìë ìê³ ìë ë³ì를 ê°ë¦¬í¨ë¤ê³ ííí ìë ìê² ë¤. ìë¡ì´ ë³ìê°ì ë³íë ìëë³ìì ê°ì ìí¥ì ì£¼ê³ ë°ëë¡ ìëë³ìì ê°ì´ ë³íì¬ë ìë¡ì´ ë³ìì ìí¥ì 미ì¹ë¤. ê²°ì½ ê°ì ë³µì¬íë ê²ê³¼ë ë¤ë¥¸ ê°ë ì´ë¼ í ì ìë¤. ë°ë¼ì í¬ê¸°ê° í° ë°°ì´ì´ë ê°ì²´ë¥¼ ì§ì í ëë ë°ë³µë¬¸ì ìííëë° ìì´ ìíìëê° ë¹¨ë¼ì¡ë¤. </para> <para> To assign by reference, simply prepend an ampersand (&) to the beginning of the variable which is being assigned (the source variable). For instance, the following code snippet outputs 'My name is Bob' twice: - <informalexample> - <programlisting role="php"> + <informalexample> <programlisting role="php"> <?php $foo = 'Bob'; // Assign the value 'Bob' to $foo $bar = &$foo; // Reference $foo via $bar. @@ -66,14 +24,10 @@ echo $foo; // $foo is altered too. echo $bar; ?> - </programlisting> - </informalexample> - </para> - <para> + </programlisting> </informalexample> </para> <para> One important thing to note is that only named variables may be assigned by reference. - <informalexample> - <programlisting role="php"> + <informalexample> <programlisting role="php"> <?php $foo = 25; $bar = &$foo; // This is a valid assignment. @@ -85,172 +39,66 @@ $bar = &test(); // Invalid. ?> - </programlisting> - </informalexample> - </para> - </sect1> - <sect1 id="language.variables.predefined"> - <title>미리 ì ìë ë³ì (Predefined variables)</title> - <simpara> - PHPë 모ë ì¤í¬ë¦½í¸ì ëí´ ê·¸ ì¤í¬ë¦½í¸ê° ì¤í ë ë ì¬ë¬ê°ì 미리 ì ìë ë³ì를 ì ê³µíë¤. - ì´ ë³ìì¤ ìë²ì ì¢ ë¥ë ë²ì , 기í ë¤ë¥¸ ìì¸ì¼ë¡ ì¸í´ ë¬ë¼ì§ë ê²ë ë§ìë°, ê·¸ë° ë³ìë ì´ê³³ì 문ìí ëì§ ììë¤. - ëí ì´ ë³ìì¤ ë¤ìë PHPê° command-lineì¼ë¡ ëìí ëë ì¬ì©í ì ìë¤. - </simpara> - <simpara> + </programlisting> </informalexample> </para> </sect1> <sect1 id="language.variables.predefined"> <title>미리 ì ìë ë³ì (Predefined variables)</title> <simpara>PHPë 모ë ì¤í¬ë¦½í¸ì ëí´ ê·¸ ì¤í¬ë¦½í¸ê° ì¤í ë ë ì¬ë¬ê°ì 미리 ì ìë ë³ì를 ì ê³µíë¤. +ì´ ë³ìì¤ ìë²ì ì¢ ë¥ë ë²ì , 기í ë¤ë¥¸ ìì¸ì¼ë¡ ì¸í´ ë¬ë¼ì§ë ê²ë ë§ìë°, ê·¸ë° ë³ìë ì´ê³³ì 문ìí ëì§ ììë¤. +ëí ì´ ë³ìì¤ ë¤ìë PHPê° command-lineì¼ë¡ ëìí ëë ì¬ì©í ì ìë¤. + </simpara> <simpara> ì´ë° ì¬ë¬ ìì¸ì´ ìì§ë§ ì´ê³³ììë ê°ì¥ ì¼ë°ì ì¸ íê²½ì¸ <ulink url="&url.apache;">Apache</ulink> 1.3.6 ìì 모ëë¡ PHP3를 ì¤ì¹í íê²½ììì 미리 ì ìë ë³ì를 ì´í´ë³´ëë¡ íì. - </simpara> - <simpara> + </simpara> <simpara> ì¬ë¬ë¶ì´ ì¬ì©íë ìì¤í ì 모ë 미리 ì ìë ë³ì를 ë³´ë ¤ë©´ <function>phpinfo</function> í¨ì를 ì¬ì©íì. (ì´ í¨ìë ë¤ë¥¸ ì¬ë¬ ì ì©í ì ë³´ë ìë ¤ì¤ë¤.) - </simpara> - <note> - <simpara> + </simpara> <note> <simpara> ì¬ê¸°ëì¨ ëª©ë¡ì ìì íì§ ìë¤. (ìë²½í ìê°ë ìë¤.) ì´ ëª©ë¡ì ë¨ìí ì¬ë¬ë¶ì ì¤í¬ë¦½í¸ìì ì´ë¤ ì¢ ë¥ì 미리 ì ìë ë³ìê° ì¬ì©ë ì ìëê°ì ììì¼ ë¿ì´ë¤. - </simpara> - </note> - <sect2 id="language.variables.predefined.apache"> - <title>Apache variables</title> - <simpara> + </simpara> </note> <sect2 id="language.variables.predefined.apache"> <title>Apache variables</title> <simpara> ì´ ë³ìë <ulink url="&url.apache;">Apache</ulink> ì¹ìë²ë¡ë¶í° ìì±ë ê²ì´ë¤. ë§ì½ ì¬ë¬ë¶ì´ ë¤ë¥¸ ì¹ìë²ë¥¼ ì¬ì©íê³ ìë¤ë©´ ì´ì ëì¼í ë³ìê° ìì±ëë¤ê³ ë³´ì¥í ì ìë¤. ìë§ë ì¼ë¶ë ìì´ì§ê³ , ì¬ê¸°ì ìë ë³ìê° ìë¡ ì길 ê²ì´ë¤. ì¬ê¸°ì ìë ë³ìì¤ ëë¶ë¶ì <ulink url="&url.cgispec;">CGI 1.1 specification</ulink>ìì ëì¨ ê²ì´ê³ , ê·¸ ë´ì©ëë¡ ì¬ì©ëë¤. - </simpara> - <simpara> + </simpara> <simpara> ì´ê³³ì ìë ë³ìì¤ PHPê° command lineì¼ë¡ ëìí ê²½ì° ì¬ì©ë ì ìë ê²ì ê±°ì ìë¤. - </simpara> - <para> - <variablelist> - <varlistentry> - <term>GATEWAY_INTERFACE</term> - <listitem> - <simpara> + </simpara> <para> <variablelist> <varlistentry> <term>GATEWAY_INTERFACE</term> <listitem> <simpara> ìë²ê° ì¬ì©íê³ ìë CGI specificationì revision. ì: 'CGI/1.1'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_NAME</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_NAME</term> <listitem> <simpara> íì¬ ì¤í¬ë¦½í¸ê° ì¤íëê³ ìë í¸ì¤í¸ì ì´ë¦. ë§ì½ ì¤í¬ë¦½í¸ê° ê°ì í¸ì¤í¸ìì ì¤íëê³ ìë¤ë©´, ì´ ê°ì ê°ì í¸ì¤í¸ì ê°ì´ ë ê²ì´ë¤. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_SOFTWARE</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_SOFTWARE</term> <listitem> <simpara> ì구ì ëí ëëµì í¤ëì ì¬ì©í ìë² identification 문ìì´ - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_PROTOCOL</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_PROTOCOL</term> <listitem> <simpara> íì´ì§ê° ì구ëì´ì§ ë ì¬ì©í íë¡í ì½ì ì´ë¦ê³¼ 리ë¹ì ¼. ì: 'HTTP/1.0'; - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>REQUEST_METHOD</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>REQUEST_METHOD</term> <listitem> <simpara> Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>QUERY_STRING</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>QUERY_STRING</term> <listitem> <simpara> í´ë¹ íì´ì§ë¥¼ ì ê·¼í ë ì¬ì©ë query string. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>DOCUMENT_ROOT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>DOCUMENT_ROOT</term> <listitem> <simpara> íì¬ ì¤í¬ë¦½í¸ê° ìíì¤ì¸ document root ëë í 리. ìë²ì ì¤ì íì¼ì ì ìëì´ ìë¤. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ACCEPT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_ACCEPT</term> <listitem> <simpara> Contents of the <literal>Accept:</literal> header from the current request, if there is one. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ACCEPT_CHARSET</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_ACCEPT_CHARSET</term> <listitem> <simpara> Contents of the <literal>Accept-Charset:</literal> header from the current request, if there is one. Example: 'iso-8859-1,*,utf-8'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ENCODING</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_ENCODING</term> <listitem> <simpara> Contents of the <literal>Accept-Encoding:</literal> header from the current request, if there is one. Example: 'gzip'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ACCEPT_LANGUAGE</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_ACCEPT_LANGUAGE</term> <listitem> <simpara> Contents of the <literal>Accept-Language:</literal> header from the current request, if there is one. Example: 'en'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_CONNECTION</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_CONNECTION</term> <listitem> <simpara> Contents of the <literal>Connection:</literal> header from the current request, if there is one. Example: 'Keep-Alive'. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_HOST</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_HOST</term> <listitem> <simpara> Contents of the <literal>Host:</literal> header from the current request, if there is one. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_REFERER</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_REFERER</term> <listitem> <simpara> The address of the page (if any) which referred the browser to the current page. This is set by the user's browser; not all browsers will set this. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_USER_AGENT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_USER_AGENT</term> <listitem> <simpara> Contents of the <literal>User_Agent:</literal> header from the current request, if there is one. This is a string denoting the browser software being used to view the current @@ -259,128 +107,57 @@ this value with <function>get_browser</function> to tailor your page's functionality to the capabilities of the user's browser. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>REMOTE_ADDR</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>REMOTE_ADDR</term> <listitem> <simpara> The IP address from which the user is viewing the current page. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>REMOTE_PORT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>REMOTE_PORT</term> <listitem> <simpara> The port being used on the user's machine to communicate with the web server. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SCRIPT_FILENAME</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SCRIPT_FILENAME</term> <listitem> <simpara> The absolute pathname of the currently executing script. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_ADMIN</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_ADMIN</term> <listitem> <simpara> The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_PORT</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_PORT</term> <listitem> <simpara> The port on the server machine being used by the web server for communication. For default setups, this will be '80'; using SSL, for instance, will change this to whatever your defined secure HTTP port is. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SERVER_SIGNATURE</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SERVER_SIGNATURE</term> <listitem> <simpara> String containing the server version and virtual host name which are added to server-generated pages, if enabled. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>PATH_TRANSLATED</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>PATH_TRANSLATED</term> <listitem> <simpara> Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>SCRIPT_NAME</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>SCRIPT_NAME</term> <listitem> <simpara> Contains the current script's path. This is useful for pages which need to point to themselves. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>REQUEST_URI</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>REQUEST_URI</term> <listitem> <simpara> The URI which was given in order to access this page; for instance, '/index.html'. - </simpara> - </listitem> - </varlistentry> - </variablelist> - </para> - </sect2> - <sect2 id="language.variables.predefined.environment"> - <title>Environment variables</title> - <simpara> + </simpara> </listitem> </varlistentry> </variablelist> </para> </sect2> <sect2 id="language.variables.predefined.environment"> <title>Environment variables</title> <simpara> These variables are imported into PHP's global namespace from the environment under which the PHP parser is running. Many are provided by the shell under which PHP is running and different systems are likely running different kinds of shells, a definitive list is impossible. Please see your shell's documentation for a list of defined environment variables. - </simpara> - <simpara> + </simpara> <simpara> Other environment variables include the CGI variables, placed there regardless of whether PHP is running as a server module or CGI processor. - </simpara> - </sect2> - <sect2 id="language.variables.predefined.php"> - <title>PHP variables</title> - <simpara> + </simpara> </sect2> <sect2 id="language.variables.predefined.php"> <title>PHP variables</title> <simpara> These variables are created by PHP itself. The <varname>$HTTP_*_VARS</varname> variables are available only if the <link linkend="ini.track-vars">track_vars</link> configuration is turned on. - </simpara> - <note> - <para> + </simpara> <note> <para> As of PHP 4.0.3, <link linkend="ini.track-vars">track_vars</link> is always turned on, regardless of the configuration file setting. - </para> - </note> - <para> + </para> </note> <para> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the @@ -391,124 +168,53 @@ possibly malicious intent. If you cannot turn off <link linkend="ini.register-globals">register_globals</link>, you must take whatever steps are necessary to ensure that the data you are using is safe. - </para> - <para> - <variablelist> - <varlistentry> - <term>argv</term> - <listitem> - <simpara> + </para> <para> <variablelist> <varlistentry> <term>argv</term> <listitem> <simpara> Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>argc</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>argc</term> <listitem> <simpara> Contains the number of command line parameters passed to the script (if run on the command line). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>PHP_SELF</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>PHP_SELF</term> <listitem> <simpara> The filename of the currently executing script, relative to the document root. If PHP is running as a command-line processor, this variable is not available. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_COOKIE_VARS</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_COOKIE_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script via HTTP cookies. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_GET_VARS</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_GET_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script via the HTTP GET method. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_POST_VARS</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_POST_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script via the HTTP POST method. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_POST_FILES</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_POST_FILES</term> <listitem> <simpara> An associative array of variables containing information about files uploaded via the HTTP POST method. See <link linkend="features.file-upload.post-method">POST method uploads</link> for information on the contents of <varname>$HTTP_POST_FILES</varname>. - </simpara> - <para> - <varname>$HTTP_POST_FILES</varname> is available only in PHP + </simpara> <para> <varname>$HTTP_POST_FILES</varname> is available only in PHP 4.0.0 and later. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_ENV_VARS</term> - <listitem> - <simpara> + </para> </listitem> </varlistentry> <varlistentry> <term>HTTP_ENV_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script via the parent environment. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term>HTTP_SERVER_VARS</term> - <listitem> - <simpara> + </simpara> </listitem> </varlistentry> <varlistentry> <term>HTTP_SERVER_VARS</term> <listitem> <simpara> An associative array of variables passed to the current script from the HTTP server. These variables are analogous to the Apache variables described above. - </simpara> - </listitem> - </varlistentry> - </variablelist> - </para> - </sect2> - </sect1> - <sect1 id="language.variables.scope"> - <title>ë³ì ì¬ì© ë²ì (Variable Scope)</title> - <simpara> + </simpara> </listitem> </varlistentry> </variablelist> </para> </sect2> </sect1> <sect1 id="language.variables.scope"> <title>ë³ì ì¬ì© ë²ì (Variable Scope)</title> <simpara> ë³ìê° ì¬ì©ê°ë¥í ê³³ì ê·¸ ë³ìê° ì ì¸ë ê³³ ììì ë§ì´ë¤. PHP ë³ìì ëë¶ë¶ì í ê°ì ë²ì(single scope)ë§ì ê°ì§ê³ ìë¤. ì´ ë²ìë includeë requireëì´ì ì½íì¨ íì¼ìë ëì¼íê² ì ì©ëë¤. ì를ë¤ì´ : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = 1; include "b.inc"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ììì <varname>$a</varname>ë³ìë <filename>b.inc</filename> ì¤í¬ë¦½í¸ììë ì¬ì©í ì ìë¤. 기본ì ì¼ë¡ í¨ì ììì ì ì¸ë ê²ì í¨ì ìììë§ ì¬ì©ëë ì§ì ë³ìì´ë¤. ëí í¨ì ììì ì¬ì©ëë í¨ìë¤ì 기본ì ì¼ë¡ ì§ì ë³ìë¼ê³ ê°ì íê³ ì°¾ê² ëë¤. ì를 ë¤ì´: - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = 1; /* global scope */ Function Test () { @@ -516,16 +222,12 @@ } Test (); - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ì´ ì¤í¬ë¦½í¸ë í¨ì ìì <varname>$a</varname> ë³ì를 ì§ìë³ìë¡ ê°ì íìê³ , ì§ìë³ì $aìë ì무 ê°ë ëì ëì§ ìì기 ë문ì ìë¬´ë° ì¶ë ¥ë ëíëì§ ìëë¤. ì´ê²ì Cìë ì½ê° ì°¨ì´ê° ëë ë¶ë¶ì´ë¤. PHPìì ì ìë³ì를 ì¬ì©íë ¤ë©´ ì¬ì©íê³ ì¶ì ì ì ë³ì를 í¨ì ìì global ì ì¸ì í´ ì£¼ì´ì¼ íë¤. ì를 ë¤ì´ : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = 1; $b = 2; @@ -537,20 +239,15 @@ Sum (); echo $b; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ìì ì¤í¬ë¦½í¸ë "3"ì ì¶ë ¥í ê²ì´ë¤. í¨ì ë´ìì <varname>$a</varname>ì <varname>$b</varname>를 globalë¡ ì ì¸íì¼ë¯ë¡, ì´ í¨ìë´ì $a, $bë ì ì ë³ì를 참조íê² ëë¤. í¨ì ë´ìì ë¤ë£° ì ìë ì ìë³ìì ê°ììë ì íì´ ìë¤. - </simpara> - <simpara> + </simpara> <simpara> ì ì ë³ì를 참조íë ë ë²ì§¸ ë°©ë²ì PHPìì í¹ë³í ì ìíê³ ìë $GLOBALSë¼ë ë°°ì´ì ì¬ì©íë ê²ì´ë¤. ìì ì를 ë¤ìê³¼ ê°ì´ ë°ê¿ ì¸ ì ìë¤. : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = 1; $b = 2; @@ -560,26 +257,18 @@ Sum (); echo $b; - </programlisting> - </informalexample> - <simpara> - <varname>$GLOBALS</varname> ë°°ì´ì ë³ìì´ë¦ì´ Keyê° ëê³ , + </programlisting> </informalexample> <simpara> <varname>$GLOBALS</varname> ë°°ì´ì ë³ìì´ë¦ì´ Keyê° ëê³ , ê·¸ ë³ìì ë´ì©ì´ ê°ì´ ëë ìì를 ê°ì§ associative ë°°ì´ì´ë¤. - </simpara> - <simpara> + </simpara> <simpara> ë³ì ë²ìì ê´ë ¨íì¬ ììëì´ì¼ í ë ë¤ë¥¸ ë´ì©ì¼ë¡ <emphasis>ì ì </emphasis> ë³ì(static variable)ê° ìë¤ë¤. ì ì ë³ìë ì§ì í¨ì ë´ììë§ ì¡´ì¬íì§ë§ ì§ì í¨ìê° ì¢ ë£ëì´ë ê·¸ ê°ì ì½ì´ë²ë¦¬ì§ ìê³ ê°ì§ê³ ìë¤. ë¤ì ì를 ë³´ì : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> Function Test () { $a = 0; echo $a; $a++; } - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> This function is quite useless since every time it is called it sets <varname>$a</varname> to <literal>0</literal> and prints "0". The <varname>$a</varname>++ which increments the @@ -587,30 +276,23 @@ <varname>$a</varname> variable disappears. To make a useful counting function which will not lose track of the current count, the <varname>$a</varname> variable is declared static: - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> Function Test () { static $a = 0; echo $a; $a++; } - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> Now, every time the Test() function is called it will print the value of <varname>$a</varname> and increment it. - </simpara> - <simpara> + </simpara> <simpara> ëí ì ì ë³ìë ë¤ìê³¼ ê°ì´ recursionìì ë°ëì íìíë¤. ì¬ê·ì ì¸ í¨ìë ì기 ìì ì í¨ì를 í¸ì¶íë ê²ì ë§íë¤. ì¬ê·ì ì¸ í¨ì를 ì¬ì©í ëë 무í 루íì ë¹ ì§ ì ì기 ë문ì ë§¤ì° ì£¼ì를 ìíë¤. ë°ë¼ì ì¬ë¬ë¶ì ì¬ê· í¸ì¶ì ëë´ë ì ì í ë°©ë²ì ë§ë ¨í´ ëì´ì¼ íë¤. ë¤ìì ê°ë¨í ìì ë 10ë²ì ì¬ê·ì í¸ì¶ì íë¤. ì ì ë³ì <varname>$count</varname>를 ì¬ì©íì¬ ì¤ë¨ë ì기를 ì ì ìë¤. - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> Function Test () { static $count = 0; @@ -621,50 +303,28 @@ } $count--; } - </programlisting> - </informalexample> - </sect1> - <sect1 id="language.variables.variable"> - <title>ê°ë³ ë³ì (Variable variables)</title> - <simpara> + </programlisting> </informalexample> </sect1> <sect1 id="language.variables.variable"> <title>ê°ë³ ë³ì (Variable variables)</title> <simpara> ê°ë ë³ìì ì´ë¦ì ë³ê²½í ì ìë¤ë©´ í¸ë¦¬íë¤ê³ ëë ëê° ìë¤. ì´ì ë³ìì ì´ë¦ì ë°ê¾¸ì´ ì¬ì©íë ë°©ë²ì ììë³´ì. ë³´íµì ë³ì ì ì¸ì ë¤ìê³¼ ê°ë¤.: - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $a = "hello"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ê°ë³ ë³ìì ë³ìì ê°ì ê°ì§ ìë ìê³ , ëí ì´ ê°ì ë³ìì ì´ë¦ì¼ë¡ ë¤ë£° ìë ìë¤. ìì ììì $$를 ì¬ì©íë©´ <emphasis>hello</emphasis>ê° ë³ì ì´ë¦ì´ ë ì ìë¤. ì : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> $$a = "world"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ì´ë ê² íë©´ PHPì symbol treeìë "hello"ë¼ë ê°ì ê°ì§ë <varname>$a</varname>ì "world"ë¼ë ê°ì ê°ì§ë <varname>$hello</varname>ì ë ê°ì ë³ìê° ìê¸°ê² ëë¤. ê·¸ë¬ë¯ë¡ ë¤ìê³¼ ê°ì 문ì¥ì : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> echo "$a ${$a}"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ë¤ì 문ì¥ê³¼ ë ê°ì ì¶ë ¥ì ëíë´ê² ëë¤.: - </simpara> - <informalexample> - <programlisting> + </simpara> <informalexample> <programlisting> echo "$a $hello"; - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> i.e. ëì ì¶ë ¥: <computeroutput>hello world</computeroutput>. - </simpara> - <simpara> + </simpara> <simpara> ê°ë³ ë³ì를 ë°°ì´ê³¼ í¨ê» ì¬ì©íë ¤ë©´, íê°ì§ 모í¸ì± 문ì 를 í´ê²°í´ì¼ íë¤. ê·¸ê²ì, ë§ì½ ì¬ë¬ë¶ì´ <varname>$$a[1]</varname>ì´ë¼ê³ ì¼ì¼ë©´, <varname>$a[1]</varname>ì íëì ë³ìë¡ ë³¼ ê²ì¸ì§, @@ -672,51 +332,32 @@ ë¤ìê³¼ ê°ì´ íì¬ ëª¨í¸ì±ì í´ê²°íì. ì ìì ê²½ì° <varname>${$a[1]}</varname>ë¼ê³ ì°ê³ , íìì ê²½ì°ë <varname>${$a}[1]</varname>ë¼ê³ ì°ë©´ ëë¤. ( ìì주: ê°ë³ ë³ì를 ëíë¼ ëë íì { }ë¡ ëë¬ ì¸ë ê²ì´ 보기 ì¢ê³ ì¤ë¥ë ìì¨ ì ìë¤.) - </simpara> - </sect1> - <sect1 id="language.variables.external"> - <title>PHP ë°ìì ì¨ ë³ìë¤ (Variables from outside PHP)</title> - <sect2 id="language.variables.external.form"> - <title>HTML Forms (GET and POST)</title> - <simpara> + </simpara> </sect1> <sect1 id="language.variables.external"> <title>PHP ë°ìì ì¨ ë³ìë¤ (Variables from outside PHP)</title> <sect2 id="language.variables.external.form"> <title>HTML Forms (GET and POST)</title> <simpara> í¼ì´ PHP ì¤í¬ë¦½í¸ë¡ submitëë©´ í¼ì ìë 모ë ë´ì©ë¤ì´ ìëì ì¼ë¡ ë§ë¤ì´ì§ PHP ë³ìë¡ ë¤ì´ì¨ë¤. ë§ì½ <link linkend="ini.track-vars">track_vars</link> ìµì ì´ onì¼ë¡ ì¤ì ëì´ ìì¼ë©´, ì´ ë³ìë¤ ëª¨ëë ê·¸ê²ì´ ì´ëì ë§ë¤ì´ì§ ê²ì´ëì ë°ë¼ì <varname>$HTTP_POST_VARS</varname>, <varname>$HTTP_GET_VARS</varname>, <varname>$HTTP_POST_FILES</varname>ì associative ë°°ì´ì ìì¹íê² ëë¤. - </simpara> - <para> + </simpara> <para> ì´ ë³ììëí ìì¸í ì¤ëª ì <link linkend="language.variables.predefined">미리 ì ìë ë³ì (Predefined variables)</link>ì ì½ì´ë³´ê¸° ë°ëë¤. - </para> - <para> - <example> - <title>Simple form variable</title> - <programlisting role="php"> + </para> <para> <example> <title>Simple form variable</title> <programlisting role="php"> <form action="foo.php" method="post"> Name: <input type="text" name="username"><br> <input type="submit"> </form> - </programlisting> - </example> - </para> - <para> + </programlisting> </example> </para> <para> When the above form is submitted, the value from the text input will be available in <varname>$HTTP_POST_VARS['username']</varname>. If the <link linkend="ini.register-globals">register_globals</link> configuration directive is turned on, then the variable will also be available as <varname>$username</varname> in the global scope. - </para> - <simpara> + </para> <simpara> PHP also understands arrays in the context of form variables. You may, for example, group related variables together, or use this feature to retrieve values from a multiple select input: - </simpara> - <para> - <example> - <title>More complex form variables</title> - <programlisting role="php"> + </simpara> <para> <example> <title>More complex form variables</title> <programlisting role="php"> <form action="array.php" method="post"> Name: <input type="text" name="personal[name]"><br> Email: <input type="text" name="personal[email]"><br> @@ -728,34 +369,19 @@ </select> <input type="submit"> </form> - </programlisting> - </example> - </para> - <para> + </programlisting> </example> </para> <para> In PHP 3, the array form variable usage is limited to single-dimensional arrays. In PHP 4, no such restriction applies. - </para> - <sect3 id="language.variables.external.form.submit"> - <title>IMAGE SUBMITì ë³ì ì´ë¦</title> - <simpara> + </para> <sect3 id="language.variables.external.form.submit"> <title>IMAGE SUBMITì ë³ì ì´ë¦</title> <simpara> í¼ì submití ë ì¼ë°ì ì¼ë¡ ì¬ì©íë submit ë²í¼ ëì ë¤ìê³¼ ê°ì´ 그림ì ì¬ì©í ìë ìë¤. : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> <input type=image src="image.gif" name="sub"> - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ì¬ì©ìê° image를 í´ë¦íë©´, í¼ì sub_xì sub_yì ë ê°ì ë³ìê° ì¶ê°ëì´ ìë²ì ì ì¡ëë¤. ì´ ë ë³ìë ì´ë¯¸ì§ìì ì¬ì©ìê° clickí ìì¹ ì 보를 ë´ê³ ìë¤. ì¼ë¶ ë¸ë¼ì°ì ììë ë°ì¤(_)ëì ë§ì¹¨í(.)를 ì¬ì©íë ê²½ì°ë ìëë°, PHPë ì´ë° ê²½ì° ìëì ì ë§ì¹¨í(.)를 ë°ì¤(_)ë¡ ë°ê¿ì¤ë¤. - </simpara> - </sect3> - </sect2> - <sect2 id="language.variables.external.cookies"> - <title>HTTP Cookies</title> - <simpara> + </simpara> </sect3> </sect2> <sect2 id="language.variables.external.cookies"> <title>HTTP Cookies</title> <simpara> PHPë HTTP ì¿ í¤ë¥¼ <ulink url="&spec.cookies;">Netscape's Spec</ulink>ì ì ìì ë°ë¼ ì ê³µíë¤. Cookie ë©ì¹´ëì¦ì í¸ëí¹ì´ë ì¬ì©ì ìë³ ë±ì ìí´ ì격 browserì ì ì¥ë ë°ì´í°ë¥¼ ëë ¤ ë°ë ê³¼ì ì ë§íë¤. ì¬ë¬ë¶ì cookie를 ì¤ì í기 ìí´ <function>SetCookie</function>í¨ì를 ì¬ì©í ì ìë¤. @@ -763,52 +389,31 @@ í¨ìë ë¸ë¼ì°ì ë¡ ë³´ë´ë ì´ë¤ ë°ì´í°ë³´ë¤ë ìì ì¬ì©í´ì¼ íë¤. ì´ ì ì½ì <function>Header</function> í¨ìì ê°ì ì ì½ì¼ë¡ ë³´ë©´ ëë¤. ë³´ë¸ ëª¨ë cookieë ìëì ì¼ë¡ GETì´ë POST ë°©ì ë°ì´í°ì ê°ì PHP ë³ìë¡ ë³íëë¤. - </simpara> - <simpara> + </simpara> <simpara> ë§ì½ ì¬ë¬ë¶ì´ ëì¼í cookieì ì¬ë¬ ê°ì ì ì¥íê³ ì¶ë¤ë©´ Cookieì´ë¦ì <emphasis>[]</emphasis>를 ëíë©´ ëë¤. ì를 ë¤ì´ : - </simpara> - <informalexample> - <programlisting role="php"> + </simpara> <informalexample> <programlisting role="php"> SetCookie ("MyCookie[]", "Testing", time()+3600); - </programlisting> - </informalexample> - <simpara> + </programlisting> </informalexample> <simpara> ì¿ í¤ë ìë¡ ì¤ì íë©´ pathë ëë©ì¸ì´ ë¤ë¥´ì§ ìë í ì´ì ì ì¿ í¤ë¥¼ ë®ì´ì°ê² ëë¤. ê·¸ë¬ë¯ë¡ ì¼í ì¹´í¸ ê°ì ìì© íë¡ê·¸ë¨ììë ë¤ìê³¼ ê°ì´ ì¹´ì´í°ë¥¼ ì¬ì©íì¬, ì´ê²ì 기ì¤ì¼ë¡ Cookie를 ì¬ì©íë ê²ì´ ì¢ë¤. ì : - </simpara> - <example> - <title>SetCookie Example</title> - <programlisting role="php"> + </simpara> <example> <title>SetCookie Example</title> <programlisting role="php"> $Count++; SetCookie ("Count", $Count, time()+3600); SetCookie ("Cart[$Count]", $item, time()+3600); - </programlisting> - </example> - </sect2> - <sect2 id="language.variables.external.environment"> - <title>íê²½ ë³ì (Environment variables)</title> - <para> + </programlisting> </example> </sect2> <sect2 id="language.variables.external.environment"> <title>íê²½ ë³ì (Environment variables)</title> <para> PHPë ìëì ì¼ë¡ íê²½ ë³ìë¤ì ì¼ë°ì ì¸ PHP ë³ìë¡ ë§ë ë¤. - <informalexample> - <programlisting role="php"> + <informalexample> <programlisting role="php"> echo $HOME; /* Shows the HOME environment variable, if set. */ - </programlisting> - </informalexample> - </para> - <para> + </programlisting> </informalexample> </para> <para> GET, POST, Cookie ë©ì¹´ëì¦ì íµí´ì ë¤ì´ ì¨ ì ë³´ë¡ë¶í°ë PHP ë³ìê° ì기ë¯ë¡, ëëë¡ íê²½ë³ìë¡ë¶í° ë°ìê²ì´ íì¤íê°ë¥¼ íì¸í íìê° ìì ëë ìë¤. ì´ë¥¼ ìí´ <function>getenv</function> í¨ì를 ì¬ì©íë¤. íê²½ ë³ì를 ì¤ì í기 ìí´ìë <function>putenv</function> í¨ì를 ì¬ì©íë¤. - </para> - </sect2> - <sect2 id="language.variables.external.dot-in-names"> - <title>ì¸ë¶ ë³ìëª ì ìë '.' (Dots in incoming variable names)</title> - <para> + </para> </sect2> <sect2 id="language.variables.external.dot-in-names"> <title>ì¸ë¶ ë³ìëª ì ìë '.' (Dots in incoming variable names)</title> <para> ì¼ë°ì ì¼ë¡ PHPë ë³ì를 ì¤í¬ë¦½í¸ë¡ ê°ì ¸ì¬ ë ë³ìëª ì ë°ê¾¸ì§ ìëë¤. ê·¸ë¬ë, PHPì ë³ìëª ìë '.' (ì )ì ì¬ì©í ì ìë¤. ë¤ìê³¼ ê°ì ê²½ì°ë¥¼ ë³´ì. : <programlisting role="php"> @@ -817,25 +422,16 @@ ìì ê²½ì° PHP íìë <varname>$varname</varname>ì´ë¼ë ë³ìì, ì°ê²° ì°ì°ì, 'ext'(ë°ì´íê° ìë ê²½ì° ê·¸ê²ì´ ì´ë¤ ìë ¤ì§ í¤ë ìì½ì´ê° ìëë©´ 문ìì´ë¡ ì·¨ê¸ëë¤.)ë¡ í´ìíë¤. ì´ê²ì ì°ë¦¬ê° ìíë ê²°ê³¼ê° ìëë¤. - </para> - <para> + </para> <para> ìì ê°ì ì´ì ë¡ PHPë ì¸ë¶ìì ë¶ë¬ë¤ì¸ ë³ìì ì´ë¦ì '.'ì´ ìì¼ë©´ '_'(ë°ì¤)ë¡ ë°ê¾¸ì´ ì½ì´ë¤ì¸ë¤. - </para> - </sect2> - <sect2 id="language.variables.determining-type-of"> - <title>ë³ìì Type íë¨ (Determining variable types)</title> - <para> + </para> </sect2> <sect2 id="language.variables.determining-type-of"> <title>ë³ìì Type íë¨ (Determining variable types)</title> <para> PHPë ë³ìì typeì ììì ì íê³ (ì¼ë°ì ì¼ë¡) íìí ê²½ì°ìë ê·¸ typeì ë°ê¾¸ë¯ë¡, í¹ì ìì ì ê·¸ ë³ì ì´ë¤ typeì¸ì§ë ì½ê² ì ì ìë¤. PHPë ë³ìì typeì ìì보기 ìí´ ì¬ë¬ê°ì í¨ì를 ê°ì§ê³ ìë¤. <function>gettype</function>, <function>is_long</function>, <function>is_double</function>, <function>is_string</function>, <function>is_array</function>, <function>is_object</function> ê° ê·¸ê²ë¤ì´ë¤. - </para> - </sect2> - </sect1> -</chapter> -<!-- Keep this comment at the end of the file + </para> </sect2> </sect1></chapter><!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t @@ -850,4 +446,4 @@ sgml-local-catalogs:nil sgml-local-ecat-files:nil End: - --> + -->ÿ \ No newline at end of file