cvs: phpdoc-ja /language namespaces.xml /reference/datetime/datetimezone gettransitions.xml /reference/msql/functions msql-pconnect.xml
/reference/pcre pattern.syntax.xml /reference/soap/soapclient getlastresponse.xml gettypes.xml
| From: | TAKAGI Masahiro | Date: | Wed, 11 Mar 2009 03:41:09 +0000 |
| Subject: | cvs: phpdoc-ja /language namespaces.xml /reference/datetime/datetimezone gettransitions.xml /reference/msql/functions msql-pconnect.xml /reference/pcre pattern.syntax.xml /reference/soap/soapclient getlastresponse.xml gettypes.xml |
||
| Groups: | php.doc.ja | ||
| Request: | Send a blank email to doc-ja+get-2431@lists.php.net to get a copy of this message | ||
takagi Wed Mar 11 03:41:09 2009 UTC
Modified files:
/phpdoc-ja/reference/soap/soapclient gettypes.xml
getlastresponse.xml
/phpdoc-ja/reference/pcre pattern.syntax.xml
/phpdoc-ja/reference/msql/functions msql-pconnect.xml
/phpdoc-ja/reference/datetime/datetimezone gettransitions.xml
/phpdoc-ja/language namespaces.xml
Log:
sync with en.
http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/soap/soapclient/gettypes.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-ja/reference/soap/soapclient/gettypes.xml diff -u phpdoc-ja/reference/soap/soapclient/gettypes.xml:1.1 phpdoc-ja/reference/soap/soapclient/gettypes.xml:1.2 --- phpdoc-ja/reference/soap/soapclient/gettypes.xml:1.1 Mon Feb 23 03:04:32 2009 +++ phpdoc-ja/reference/soap/soapclient/gettypes.xml Wed Mar 11 03:41:08 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> <!-- CREDITS: hirokawa,shimooka --> <refentry xml:id="soapclient.gettypes" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/soap/soapclient/getlastresponse.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-ja/reference/soap/soapclient/getlastresponse.xml diff -u phpdoc-ja/reference/soap/soapclient/getlastresponse.xml:1.1 phpdoc-ja/reference/soap/soapclient/getlastresponse.xml:1.2 --- phpdoc-ja/reference/soap/soapclient/getlastresponse.xml:1.1 Mon Feb 23 03:04:32 2009 +++ phpdoc-ja/reference/soap/soapclient/getlastresponse.xml Wed Mar 11 03:41:08 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <!-- CREDITS: hirokawa,shimooka --> <refentry xml:id="soapclient.getlastresponse" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> @@ -48,7 +48,7 @@ <?php $client = SoapClient("some.wsdl", array('trace' => 1)); $result = $client->SomeFunction(); -echo "REsponse:\n" . $client->__getLastResponse() . "\n"; +echo "Response:\n" . $client->__getLastResponse() . "\n"; ?> ]]> </programlisting> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/pcre/pattern.syntax.xml?r1=1.18&r2=1.19&diff_format=u Index: phpdoc-ja/reference/pcre/pattern.syntax.xml diff -u phpdoc-ja/reference/pcre/pattern.syntax.xml:1.18 phpdoc-ja/reference/pcre/pattern.syntax.xml:1.19 --- phpdoc-ja/reference/pcre/pattern.syntax.xml:1.18 Fri Jan 9 00:13:41 2009 +++ phpdoc-ja/reference/pcre/pattern.syntax.xml Wed Mar 11 03:41:08 2009 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.18 $ --> +<!-- $Revision: 1.19 $ --> <!-- splitted from ./ja/functions/pcre.xml, last change in rev 1.1 --> -<!-- EN-Revision: 1.23 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: 1.24 Maintainer: hirokawa Status: ready --> <!-- Credits: haruki --> <chapter xml:id="reference.pcre.pattern.syntax" xmlns="http://docbook.org/ns/docbook"> <title>ãã¿ã¼ã³æ§æ</title> @@ -908,6 +908,8 @@ \, -, (å§ç«¯ã®)^ ããã³çµç«¯ã® ] 以å¤ã®ãã¹ã¦ã®éè±æ°åã¯ã æåã¯ã©ã¹ã«ããã¦ç¹å¥ãªæå³ãæããªãæåã§ããã ã¨ã¹ã±ã¼ããã¦ãåé¡ã¯ããã¾ããã + ãã¿ã¼ã³ã®çµç«¯æåã¯å¸¸ã«ç¹å¥æ±ããããã®ã§ã + æ£è¦è¡¨ç¾å ã§ç§ç¨ããå ´åã¯å¿ ãã¨ã¹ã±ã¼ãããªããã°ãªãã¾ããã </para> </section> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/msql/functions/msql-pconnect.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc-ja/reference/msql/functions/msql-pconnect.xml diff -u phpdoc-ja/reference/msql/functions/msql-pconnect.xml:1.5 phpdoc-ja/reference/msql/functions/msql-pconnect.xml:1.6 --- phpdoc-ja/reference/msql/functions/msql-pconnect.xml:1.5 Fri Jun 22 14:32:16 2007 +++ phpdoc-ja/reference/msql/functions/msql-pconnect.xml Wed Mar 11 03:41:08 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.9 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.10 Maintainer: hirokawa Status: ready --> <!-- CREDITS: takagi --> <refentry xml:id="function.msql-pconnect" xmlns="http://docbook.org/ns/docbook"> <refnamediv> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml diff -u phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml:1.1 phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml:1.2 --- phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml:1.1 Thu Feb 12 03:50:32 2009 +++ phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml Wed Mar 11 03:41:08 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> <refentry xml:id="datetimezone.gettransitions" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> @@ -55,6 +55,31 @@ </para> </refsect1> + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.3.0</entry> + <entry> + ãªãã·ã§ã³ã® <parameter>timestamp_begin</parameter> ããã³ <parameter>timestamp_end</parameter> + ã追å ããã¾ããã + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + <refsect1 role="examples"> &reftitle.examples; <para> http://cvs.php.net/viewvc.cgi/phpdoc-ja/language/namespaces.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc-ja/language/namespaces.xml diff -u phpdoc-ja/language/namespaces.xml:1.7 phpdoc-ja/language/namespaces.xml:1.8 --- phpdoc-ja/language/namespaces.xml:1.7 Sun Mar 8 10:01:49 2009 +++ phpdoc-ja/language/namespaces.xml Wed Mar 11 03:41:08 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- EN-Revision: 1.10 Maintainer: takagi Status: working --> <chapter xml:id="language.namespaces" xmlns="http://docbook.org/ns/docbook" version="1.1"> @@ -59,7 +59,7 @@ $a = new MyClass; $c = new \my\name\MyClass; // "ã°ãã¼ãã«ç©ºé" ãåç §ãã ãã -$a = strlen('hi'); // "åå空éã®ä½¿ç¨æ³: ã°ãã¼ãã«é¢æ°ã夿°ã¸ã® +$a = strlen('hi'); // "åå空éã®ä½¿ç¨æ³: ã°ãã¼ãã«é¢æ°/宿°ã¸ã® // ç§»è¡" ãåç §ãã ãã $d = namespace\MYCONST; // "namespace æ¼ç®åããã³ __NAMESPACE__ 宿°" @@ -257,75 +257,79 @@ </para> </sect1> <sect1 xml:id="language.namespaces.basics"> - <title>Using namespaces: Basics</title> + <title>åå空éã®ä½¿ç¨æ³: åºæ¬ç·¨</title> <para> - Before discussing the use of namespaces, it is important to understand how PHP - knows which namespaced element your code is requesting. A simple analogy can be made - between PHP namespaces and a filesystem. There are three ways to access a file in a - file system: + åå空éã®ä½¿ãæ¹ã«ã¤ãã¦ããããè¨ãåã«ãã¾ã㯠+ PHP ãã©ã®ããã«ãã¦ã³ã¼ãä¸ã®è¦ç´ ã®åå空éãç¥ãã®ããçè§£ãã¦ãããã¨ãéè¦ã§ãã + PHP ã®åå空éã¯ããã¡ã¤ã«ã·ã¹ãã ã«ãã¨ãã¦èãããã¨ãã§ãã¾ãã + ãã¨ãã°ããã¡ã¤ã«ã·ã¹ãã å ã®ãã¡ã¤ã«ã«ã¢ã¯ã»ã¹ããã«ã¯æ¬¡ã® 3 ã¤ã®æ¹æ³ãããã¾ãã <orderedlist> <listitem> <simpara> - Relative file name like <literal>foo.txt</literal>. This resolves to - <literal>currentdirectory/foo.txt</literal> where currentdirectory is the - directory currently occupied. So if the current directory is - <literal>/home/foo</literal>, the name resolves to <literal>/home/foo/foo.txt</literal>. + <literal>foo.txt</literal> ã®ãããªç¸å¯¾ãã¡ã¤ã«åã使ãããã㯠+ <literal>currentdirectory/foo.txt</literal> ã¨è§£éããã¾ããããã§ã + currentdirectory ã¯ç¾å¨ãããã£ã¬ã¯ããªã表ãã¾ãããããã£ã¦ãã«ã¬ã³ããã£ã¬ã¯ããªã + <literal>/home/foo</literal> ã§ãã£ãå ´åã¯ãã㯠<literal>/home/foo/foo.txt</literal> + ã¨ãªãã¾ãã </simpara> </listitem> <listitem> <simpara> - Relative path name like <literal>subdirectory/foo.txt</literal>. This resolves - to <literal>currentdirectory/subdirectory/foo.txt</literal>. + <literal>subdirectory/foo.txt</literal> ã®ãããªç¸å¯¾ãã¹åã使ãããã㯠+ <literal>currentdirectory/subdirectory/foo.txt</literal> ã¨è§£éããã¾ãã </simpara> </listitem> <listitem> <simpara> - Absolute path name like <literal>/main/foo.txt</literal>. This resolves - to <literal>/main/foo.txt</literal>. + <literal>/main/foo.txt</literal> ã®ãããªçµ¶å¯¾ãã¹åã使ãããã㯠+ <literal>/main/foo.txt</literal> ã¨è§£éããã¾ãã </simpara> </listitem> </orderedlist> - The same principle can be applied to namespaced elements in PHP. For - example, a class name can be referred to in three ways: + PHP ã®åå空éå ã®è¦ç´ ã«ã¤ãã¦ãåãçå±ããã¦ã¯ã¾ãã¾ãã + ãã¨ãã°ãã¯ã©ã¹åãåç §ããã«ã¯æ¬¡ã® 3 ã¤ã®æ¹æ³ãããã¾ãã <orderedlist> <listitem> <simpara> - Unqualified name, or an unprefixed class name like - <literal>$a = new foo();</literal> or - <literal>foo::staticmethod();</literal>. If the current namespace is - <literal>currentnamespace</literal>, this resolves to - <literal>currentnamespace\foo</literal>. If - the code is global, non-namespaced code, this resolves to <literal>foo</literal>. + <literal>$a = new foo();</literal> ããã㯠+ <literal>foo::staticmethod();</literal> ã®ãããªé修飾å + ãããã¯ãã¬ãã£ãã¯ã¹ãªãã®ã¯ã©ã¹åã + ç¾å¨ã®åå空éã <literal>currentnamespace</literal> ã§ããå ´åããã㯠+ <literal>currentnamespace\foo</literal> ã¨è§£éããã¾ãã + åå空éã«å±ããªãã°ãã¼ãã«ãªã³ã¼ãã«ããã¦ã¯ããã㯠+ <literal>foo</literal> ã¨è§£éããã¾ãã </simpara> <simpara> - One caveat: unqualified names for functions and constants will - resolve to global functions and constants if the namespaced function or constant - is not defined. See <link linkend="language.namespaces.fallback">Using namespaces: - fallback to global function/constant</link> for details. + 注æ: 修飾ããã¦ããªã颿°ã宿°ã¯ãåå空éå ã«ãã®é¢æ°ã宿°ããªããã° + ã°ãã¼ãã«ãªé¢æ°ãããã¯å¤æ°ã¨ã¿ãªããã¾ãã詳細㯠+ <link linkend="language.namespaces.fallback">åå空éã®ä½¿ç¨æ³: + ã°ãã¼ãã«ãªé¢æ°/宿°ã¸ã®ç§»è¡</link> ãåç §ãã ããã </simpara> </listitem> <listitem> <simpara> - Qualified name, or a prefixed class name like - <literal>$a = new subnamespace\foo();</literal> or - <literal>subnamespace\foo::staticmethod();</literal>. If the current namespace is - <literal>currentnamespace</literal>, this resolves to - <literal>currentnamespace\subnamespace\foo</literal>. If - the code is global, non-namespaced code, this resolves to <literal>subnamespace\foo</literal>. + <literal>$a = new subnamespace\foo();</literal> ããã㯠+ <literal>subnamespace\foo::staticmethod();</literal> ã®ãããªä¿®é£¾å + ãããã¯ãã¬ãã£ãã¯ã¹ã¤ãã¯ã©ã¹åã + ç¾å¨ã®åå空éã <literal>currentnamespace</literal> ã§ããå ´åããã㯠+ <literal>currentnamespace\subnamespace\foo</literal> ã¨è§£éããã¾ãã + åå空éã«å±ããªãã°ãã¼ãã«ãªã³ã¼ãã«ããã¦ã¯ããã㯠+ <literal>subnamespace\foo</literal> ã¨è§£éããã¾ãã </simpara> </listitem> <listitem> <simpara> - Fully qualified name, or a prefixed name with global prefix operator like - <literal>$a = new \currentnamespace\foo();</literal> or - <literal>\currentnamespace\foo::staticmethod();</literal>. This always resolves - to the literal name specified in the code, <literal>currentnamespace\foo</literal>. + <literal>$a = new \currentnamespace\foo();</literal> ããã㯠+ <literal>\currentnamespace\foo::staticmethod();</literal> ã®ãããªå®å ¨ä¿®é£¾å + ãããã¯ã°ãã¼ãã«ãã¬ãã£ãã¯ã¹æ¼ç®åã¤ãã®ã¯ã©ã¹åã + ããã¯ã常ã«ã³ã¼ãã§è¨è¿°ãããã¨ããã®ååã§ãã + <literal>currentnamespace\foo</literal> ã¨è§£éããã¾ãã </simpara> </listitem> </orderedlist> </para> <para> - Here is an example of the three kinds of syntax in actual code: + ããã 3 ã¤ã®æ§æãå®éã®ã³ã¼ãã§ä½¿ãä¾ã次ã«ç¤ºãã¾ãã <informalexample> <simpara>file1.php</simpara> <programlisting role="php"> @@ -356,33 +360,32 @@ static function staticmethod() {} } -/* Unqualified name */ -foo(); // resolves to function Foo\Bar\foo -foo::staticmethod(); // resolves to class Foo\Bar\foo, method staticmethod -echo FOO; // resolves to constant Foo\Bar\FOO - -/* Qualified name */ -subnamespace\foo(); // resolves to function Foo\Bar\subnamespace\foo -subnamespace\foo::staticmethod(); // resolves to class Foo\Bar\subnamespace\foo, - // method staticmethod -echo subnamespace\FOO; // resolves to constant Foo\Bar\subnamespace\FOO +/* é修飾å */ +foo(); // Foo\Bar\foo 颿°ã¨è§£éããã¾ã +foo::staticmethod(); // Foo\Bar\foo ã¯ã©ã¹ã® staticmethod ã¡ã½ããã¨è§£éããã¾ã +echo FOO; // 宿° Foo\Bar\FOO ã¨è§£éããã¾ã + +/* 修飾å */ +subnamespace\foo(); // Foo\Bar\subnamespace\foo 颿°ã¨è§£éããã¾ã +subnamespace\foo::staticmethod(); // Foo\Bar\subnamespace\foo ã¯ã©ã¹ã® + // staticmethod ã¡ã½ããã¨è§£éããã¾ã +echo subnamespace\FOO; // 宿° Foo\Bar\subnamespace\FOO ã¨è§£éããã¾ã -/* Fully qualified name */ -\Foo\Bar\foo(); // resolves to function Foo\Bar\foo -\Foo\Bar\foo::staticmethod(); // resolves to class Foo\Bar\foo, method staticmethod -echo \Foo\Bar\FOO; // resolves to constant Foo\Bar\FOO +/* å®å ¨ä¿®é£¾å */ +\Foo\Bar\foo(); // Foo\Bar\foo 颿°ã¨è§£éããã¾ã +\Foo\Bar\foo::staticmethod(); // Foo\Bar\foo ã¯ã©ã¹ã® staticmethod ã¡ã½ããã¨è§£éããã¾ã +echo \Foo\Bar\FOO; // 宿° Foo\Bar\FOO ã¨è§£éããã¾ã ?> ]]> </programlisting> </informalexample> </para> <para> - Note that to access any global - class, function or constant, a fully qualified name can be used, such as - <function>\strlen</function> or <classname>\Exception</classname> or - <literal>\INI_ALL</literal>. + ã°ãã¼ãã«ãªã¯ã©ã¹ã颿°ãããã¯å®æ°ã«ã¢ã¯ã»ã¹ããã«ã¯ãå®å ¨ä¿®é£¾åã使ç¨ã㦠+ <function>\strlen</function>ã<classname>\Exception</classname> ããã㯠+ <literal>\INI_ALL</literal> ãªã©ã¨ãããã¨ãã§ãã¾ãã <example> - <title>Accessing global classes, functions and constants from within a namespace</title> + <title>ã°ãã¼ãã«ãªã¯ã©ã¹ã颿°ããã³å®æ°ã¸ã®åå空éå ããã®ã¢ã¯ã»ã¹</title> <programlisting role="php"> <![CDATA[ <?php @@ -392,9 +395,9 @@ const INI_ALL = 3; class Exception {} -$a = \strlen('hi'); // calls global function strlen -$b = \INI_ALL; // accesses global constant INI_ALL -$c = new \Exception('error'); // instantiates global class Exception +$a = \strlen('hi'); // ã°ãã¼ãã«é¢æ° strlen ãã³ã¼ã«ãã¾ã +$b = \INI_ALL; // ã°ãã¼ãã«å®æ° INI_ALL ã«ã¢ã¯ã»ã¹ãã¾ã +$c = new \Exception('error'); // ã°ãã¼ãã«ã¯ã©ã¹ Exception ã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã ?> ]]> </programlisting> @@ -402,12 +405,12 @@ </para> </sect1> <sect1 xml:id="language.namespaces.dynamic"> - <title>Namespaces and dynamic language features</title> + <title>åå空éã¨åçè¨èªæ©è½</title> <para> - PHP's implementation of namespaces is influenced by its dynamic nature as a programming - language. Thus, to convert code like the following example into namespaced code: + PHP ã«ãããåå空éã®å®è£ ã¯ãPHP èªèº«ãåçããã°ã©ãã³ã°è¨èªã§ããã¨ããæ§è³ªã«å½±é¿ãåãã¦ãã¾ãã + ãããã£ã¦ã次ã®ä¾ã®ãããªã³ã¼ããåå空éã使ã£ã¦æ¸ãç´ãã«ã¯ <example> - <title>Dynamically accessing elements</title> + <title>è¦ç´ ã¸ã®åçãªã¢ã¯ã»ã¹</title> <simpara>example1.php:</simpara> <programlisting role="php"> <![CDATA[ @@ -426,20 +429,19 @@ const constname = "global"; $a = 'classname'; -$obj = new $a; // prints classname::__construct +$obj = new $a; // classname::__construct ã¨è¡¨ç¤ºãã¾ã $b = 'funcname'; -$b(); // prints funcname -echo constant('constname'), "\n"; // prints global +$b(); // funcname ã¨è¡¨ç¤ºãã¾ã +echo constant('constname'), "\n"; // global ã¨è¡¨ç¤ºãã¾ã ?> ]]> </programlisting> </example> - One must use the fully qualified name (class name with namespace prefix). - Note that because there is no difference between a qualified and a fully qualified Name - inside a dynamic class name, function name, or constant name, the leading backslash is - not necessary. + å®å ¨ä¿®é£¾å (ã¯ã©ã¹åã«åå空éãã¬ãã£ãã¯ã¹ãã¤ãããã®) ã使ãå¿ è¦ãããã¾ãã + åçãªã¯ã©ã¹åã颿°åãããã¯å®æ°åã«ããã¦ã¯ä¿®é£¾åã¨å®å ¨ä¿®é£¾åã«å·®ã¯ãªãã®ã§ã + å é ã®ããã¯ã¹ã©ãã·ã¥ã¯ãªãã¦ããã¾ãã¾ããã <example> - <title>Dynamically accessing namespaced elements</title> + <title>åå空éã¤ãè¦ç´ ã¸ã®åçãªã¢ã¯ã»ã¹</title> <programlisting role="php"> <![CDATA[ <?php @@ -460,69 +462,70 @@ include 'example1.php'; $a = 'classname'; -$obj = new $a; // prints classname::__construct +$obj = new $a; // classname::__construct ã¨è¡¨ç¤ºãã¾ã $b = 'funcname'; -$b(); // prints funcname -echo constant('constname'), "\n"; // prints global +$b(); // funcname ã¨è¡¨ç¤ºãã¾ã +echo constant('constname'), "\n"; // global ã¨è¡¨ç¤ºãã¾ã -/* note that if using double quotes, "\\namespacename\\classname" must be used */ +/* ããã«ã¯ã©ã¼ãã使ãå ´å㯠"\\namespacename\\classname" ã¨ããªããã°ãªãã¾ãã */ $a = '\namespacename\classname'; -$obj = new $a; // prints namespacename\classname::__construct +$obj = new $a; // namespacename\classname::__construct ã¨è¡¨ç¤ºãã¾ã $a = 'namespacename\classname'; -$obj = new $a; // also prints namespacename\classname::__construct +$obj = new $a; // ããã namespacename\classname::__construct ã¨è¡¨ç¤ºãã¾ã $b = 'namespacename\funcname'; -$b(); // prints namespacename\funcname +$b(); // namespacename\funcname ã¨è¡¨ç¤ºãã¾ã $b = '\namespacename\funcname'; -$b(); // also prints namespacename\funcname -echo constant('\namespacename\constname'), "\n"; // prints namespaced -echo constant('namespacename\constname'), "\n"; // also prints namespaced +$b(); // ããã namespacename\funcname ã¨è¡¨ç¤ºãã¾ã +echo constant('\namespacename\constname'), "\n"; // namespaced ã¨è¡¨ç¤ºãã¾ã +echo constant('namespacename\constname'), "\n"; // ããã namespaced ã¨è¡¨ç¤ºãã¾ã ?> ]]> </programlisting> </example> </para> <para> - Be sure to read the <link linkend="language.namespaces.faq.quote">note about - escaping namespace names in strings</link>. + <link linkend="language.namespaces.faq.quote"> + æååä¸ã®åå空éåã®ã¨ã¹ã±ã¼ãã«é¢ããæ³¨æ</link> + ãèªãã§ãããã¨ãå¿ããªãããã«ãã¾ãããã </para> </sect1> <sect1 xml:id="language.namespaces.nsconstants"> - <title>namespace keyword and __NAMESPACE__ constant</title> + <title>namespace ãã¼ã¯ã¼ãããã³ __NAMESPACE__ 宿°</title> <para> - PHP supports two ways of abstractly accessing elements within the current namespace, - the <constant>__NAMESPACE__</constant> magic constant, and the <literal>namespace</literal> - keyword. + PHP ã«ã¯ãç¾å¨ã®åå空éå ã®è¦ç´ ã¸ã®ã¢ã¯ã»ã¹ãæ½è±¡åããããã®æ¹æ³ã 2 éãããã¾ãã + ãã¸ãã¯å®æ° <constant>__NAMESPACE__</constant> ããã³ <literal>namespace</literal> + ãã¼ã¯ã¼ããããã§ãã </para> <para> - The value of <constant>__NAMESPACE__</constant> is a string that contains the current - namespace name. In global, un-namespaced code, it contains an empty string. + <constant>__NAMESPACE__</constant> ã®å¤ã¯æååã§ãç¾å¨ã®åå空éã®ååãæ ¼ç´ããã¾ãã + åå空éã«å±ããªãã°ãã¼ãã«ãªã³ã¼ãã§ã¯ããã®ä¸èº«ã¯ç©ºæååã¨ãªãã¾ãã <example> - <title>__NAMESPACE__ example, namespaced code</title> + <title>åå空éå ã®ã³ã¼ãã§ã® __NAMESPACE__ ã®ä¾</title> <programlisting role="php"> <![CDATA[ <?php namespace MyProject; -echo '"', __NAMESPACE__, '"'; // outputs "MyProject" +echo '"', __NAMESPACE__, '"'; // "MyProject" ã¨åºåãã¾ã ?> ]]> </programlisting> </example> <example> - <title>__NAMESPACE__ example, global code</title> + <title>ã°ãã¼ãã«ãªã³ã¼ãã§ã® __NAMESPACE__ ã®ä¾</title> <programlisting role="php"> <![CDATA[ <?php -echo '"', __NAMESPACE__, '"'; // outputs "" +echo '"', __NAMESPACE__, '"'; // "" ã¨åºåãã¾ã ?> ]]> </programlisting> </example> - The <constant>__NAMESPACE__</constant> constant is useful for dynamically constructing - names, for instance: + <constant>__NAMESPACE__</constant> 宿°ã¯ãåçã«ååã使ããå ´åã«ä¾¿å©ã§ãã + ãã¨ãã°æ¬¡ã®ããã«ãªãã¾ãã <example> - <title>using __NAMESPACE__ for dynamic name construction</title> + <title>__NAMESPACE__ ã«ããåçãªååã®ä½æ</title> <programlisting role="php"> <![CDATA[ <?php @@ -539,41 +542,42 @@ </example> </para> <para> - The <literal>namespace</literal> keyword can be used to explicitly request - an element from the current namespace or a sub-namespace. It is the namespace - equivalent of the <literal>self</literal> operator for classes. + <literal>namespace</literal> ãã¼ã¯ã¼ãã使ç¨ããã¨ã + ç¾å¨ã®åå空éãããã¯ãµãåå空éå ã®è¦ç´ ãæç¤ºçã«æå®ãããã¨ãã§ãã¾ãã + ããã¯ãã¯ã©ã¹ã«ããã <literal>self</literal> + æ¼ç®åã¨åãæå³åãã®ãã®ã§ãã <example> - <title>the namespace operator, inside a namespace</title> + <title>åå空éå ã§ã® namespace æ¼ç®å</title> <programlisting role="php"> <![CDATA[ <?php namespace MyProject; -use blah\blah as mine; // see "Using namespaces: importing/aliasing" +use blah\blah as mine; // "åå空éã®ä½¿ç¨æ³: ã¤ã³ãã¼ã/ã¨ã¤ãªã¢ã¹" ãåç §ãã ãã -blah\mine(); // calls function blah\blah\mine() -namespace\blah\mine(); // calls function MyProject\blah\mine() +blah\mine(); // blah\blah\mine() 颿°ãã³ã¼ã«ãã¾ã +namespace\blah\mine(); // MyProject\blah\mine() 颿°ãã³ã¼ã«ãã¾ã -namespace\func(); // calls function MyProject\func() -namespace\sub\func(); // calls function MyProject\sub\func() -namespace\cname::method(); // calls static method "method" of class MyProject\cname -$a = new namespace\sub\cname(); // instantiates object of class MyProject\sub\cname -$b = namespace\CONSTANT; // assigns value of constant MyProject\CONSTANT to $b +namespace\func(); // MyProject\func() 颿°ãã³ã¼ã«ãã¾ã +namespace\sub\func(); // MyProject\sub\func() 颿°ãã³ã¼ã«ãã¾ã +namespace\cname::method(); // MyProject\cname ã¯ã©ã¹ã®éçã¡ã½ãã "method" ãã³ã¼ã«ãã¾ã +$a = new namespace\sub\cname(); // MyProject\sub\cname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$b = namespace\CONSTANT; // 宿° MyProject\CONSTANT ã®å¤ã $b ã«ä»£å ¥ãã¾ã ?> ]]> </programlisting> </example> <example> - <title>the namespace operator, in global code</title> + <title>ã°ãã¼ãã«ã³ã¼ãã§ã® namespace æ¼ç®å</title> <programlisting role="php"> <![CDATA[ <?php -namespace\func(); // calls function func() -namespace\sub\func(); // calls function sub\func() -namespace\cname::method(); // calls static method "method" of class cname -$a = new namespace\sub\cname(); // instantiates object of class sub\cname -$b = namespace\CONSTANT; // assigns value of constant CONSTANT to $b +namespace\func(); // func() 颿°ãã³ã¼ã«ãã¾ã +namespace\sub\func(); // sub\func() 颿°ãã³ã¼ã«ãã¾ã +namespace\cname::method(); // cname ã¯ã©ã¹ã®éçã¡ã½ãã "method" ãã³ã¼ã«ãã¾ã +$a = new namespace\sub\cname(); // sub\cname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$b = namespace\CONSTANT; // 宿° CONSTANT ã®å¤ã $b ã«ä»£å ¥ãã¾ã ?> ]]> </programlisting> @@ -581,98 +585,97 @@ </para> </sect1> <sect1 xml:id="language.namespaces.importing"> - <title>Using namespaces: Aliasing/Importing</title> + <title>åå空éã®ä½¿ç¨æ³: ã¨ã¤ãªã¢ã¹/ã¤ã³ãã¼ã</title> <para> - The ability to refer to an external fully qualified name with an alias, or importing, - is an important feature of namespaces. This is similar to the - ability of unix-based filesystems to create symbolic links to a file or to a directory. + å¤é¨ã®å®å ¨ä¿®é£¾åãã¨ã¤ãªã¢ã¹ã§åç §ãããã¤ã³ãã¼ããããããæ©è½ã¯ã + åå空éã«ããã¦é常ã«éè¦ãªãã®ã§ãã + ããã¯ãUnix ç³»ã®ãã¡ã¤ã«ã·ã¹ãã ã§ãã¡ã¤ã«ããã£ã¬ã¯ããªã¸ã®ã·ã³ããªãã¯ãªã³ã¯ã使ãããã¨ã«ä¼¼ã¦ãã¾ãã </para> <para> - PHP namespaces support - two kinds of aliasing or importing: aliasing a class name, and aliasing a namespace name. - Note that importing a function or constant is not supported. + PHP ã®åå空éã§ã¯ã2 éãã®æ¹æ³ã§ã¨ã¤ãªã¢ã¹ãã¤ã³ãã¼ãããµãã¼ããã¦ãã¾ãã + ã¯ã©ã¹åã®ã¨ã¤ãªã¢ã¹ã使ããæ¹æ³ã¨åå空éåã®ã¨ã¤ãªã¢ã¹ã使ããæ¹æ³ã§ãã + 颿°ã宿°ã®ã¤ã³ãã¼ãã¯ãµãã¼ããã¦ããªããã¨ã«æ³¨æãã¾ãããã </para> <para> - In PHP, aliasing is accomplished with the <literal>use</literal> operator. Here - is an example showing all 3 kinds of importing: + PHP ã§ã®ã¨ã¤ãªã¢ã¹ä½æã«ã¯ <literal>use</literal> æ¼ç®åã使ç¨ãã¾ãã + ããã«ã3 種é¡ãã¹ã¦ã®ã¤ã³ãã¼ãæ¹æ³ã®ä¾ã示ãã¾ãã <example> - <title>importing/aliasing with the use operator</title> + <title>use æ¼ç®åã«ããã¤ã³ãã¼ã/ã¨ã¤ãªã¢ã¹</title> <programlisting role="php"> <![CDATA[ <?php namespace foo; use My\Full\Classname as Another; -// this is the same as use My\Full\NSname as NSname +// ãã㯠use My\Full\NSname as NSname ã¨åãã§ã use My\Full\NSname; -// importing a global class +// ã°ãã¼ãã«ã¯ã©ã¹ãã¤ã³ãã¼ããã¾ã use \ArrayObject; -$obj = new namespace\Another; // instantiates object of class foo\Another -$obj = new Another; // instantiates object of class My\Full\Classname -NSname\subns\func(); // calls function My\Full\NSname\subns\func -$a = new ArrayObject(array(1)); // instantiates object of class ArrayObject -// without the "use \ArrayObject" we would instantiate an object of class foo\ArrayObject +$obj = new namespace\Another; // foo\Another ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$obj = new Another; // My\Full\Classname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +NSname\subns\func(); // My\Full\NSname\subns\func 颿°ãã³ã¼ã«ãã¾ã +$a = new ArrayObject(array(1)); // ArrayObject ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +// "use \ArrayObject" ããªããã°ãfoo\ArrayObject ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãããã¨ã«ãªãã¾ã ?> ]]> </programlisting> </example> - Note that for namespaced names (fully qualified namespace names containing - namespace separator, such as <literal>Foo\Bar</literal> as opposed to global names that - do not, such as <literal>FooBar</literal>), the leading backslash is unnecessary and not - allowed, as import names - must be fully qualified, and are not processed relative to the current namespace. + åå空éã¤ãã®åå (å®å ¨ä¿®é£¾å½¢å¼ã®åå空éã¯åºåãæåãå«ãã + <literal>Foo\Bar</literal> ã®ãããªãã®ã§ãã°ãã¼ãã«ãªå ´åã¯åºåãæåãå«ã¾ãªã + <literal>FooBar</literal> ã®ããã«ãªãã¾ã) + ã§ã¯å é ã®ããã¯ã¹ã©ãã·ã¥ã¯ä¸è¦ã§ã許å¯ãããªããã¨ã«æ³¨æãã¾ãããã + ã¤ã³ãã¼ãããååã¯å®å ¨ä¿®é£¾å½¢å¼ã§ãªããã°ãªããã + ç¾å¨ã®åå空éããã®ç¸å¯¾æå®ã§å¦çããããã¨ã¯ãªãããã§ãã </para> <para> - PHP additionally supports a convenience shortcut to place multiple use statements - on the same line + PHP ã§ã¯ãè¤æ°ã® use æãåä¸è¡ã«ç½®ãããã®ä¾¿å©ãªã·ã§ã¼ãã«ããããµãã¼ããã¦ãã¾ãã <example> - <title>importing/aliasing with the use operator, multiple use statements combined</title> + <title>use æ¼ç®åã«ããã¤ã³ãã¼ã/ã¨ã¤ãªã¢ã¹ã§ãè¤æ°ã® use æãçµã¿åãããä¾</title> <programlisting role="php"> <![CDATA[ <?php use My\Full\Classname as Another, My\Full\NSname; -$obj = new Another; // instantiates object of class My\Full\Classname -NSname\subns\func(); // calls function My\Full\NSname\subns\func +$obj = new Another; // My\Full\Classname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +NSname\subns\func(); // My\Full\NSname\subns\func 颿°ãã³ã¼ã«ãã¾ã ?> ]]> </programlisting> </example> </para> <para> - Importing is performed at compile-time, and so does not affect dynamic class, function - or constant names. + ã¤ã³ãã¼ãã¯ã³ã³ãã¤ã«æã«è¡ãããã®ã§ãåçãªã¯ã©ã¹åã颿°åã宿°åã«ã¯å½±é¿ãåã¼ãã¾ããã <example> - <title>Importing and dynamic names</title> + <title>ã¤ã³ãã¼ãã¨åçå</title> <programlisting role="php"> <![CDATA[ <?php use My\Full\Classname as Another, My\Full\NSname; -$obj = new Another; // instantiates object of class My\Full\Classname +$obj = new Another; // My\Full\Classname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã $a = 'Another'; -$obj = new $a; // instantiates object of class Another +$obj = new $a; // Another ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã ?> ]]> </programlisting> </example> </para> <para> - In addition, importing only affects unqualified and qualified names. Fully qualified - names are absolute, and unaffected by imports. + ããã«ã¤ã³ãã¼ãã®å½±é¿ãåã¶ã®ã¯é修飾åããã³ä¿®é£¾åã®ã¿ã§ãã + å®å ¨ä¿®é£¾åã¯çµ¶å¯¾çãªãã®ã§ãããã¤ã³ãã¼ãã®å½±é¿ãåãããã¨ã¯ããã¾ããã <example> - <title>Importing and fully qualified names</title> + <title>ã¤ã³ãã¼ãã¨å®å ¨ä¿®é£¾å</title> <programlisting role="php"> <![CDATA[ <?php use My\Full\Classname as Another, My\Full\NSname; -$obj = new Another; // instantiates object of class My\Full\Classname -$obj = new \Another; // instantiates object of class Another -$obj = new Another\thing; // instantiates object of class My\Full\Classname\thing -$obj = new \Another\thing; // instantiates object of class Another\thing +$obj = new Another; // My\Full\Classname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$obj = new \Another; // Another ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$obj = new Another\thing; // My\Full\Classname\thing ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$obj = new \Another\thing; // Another\thing ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã ?> ]]> </programlisting> @@ -680,24 +683,23 @@ </para> </sect1> <sect1 xml:id="language.namespaces.global"> - <title>Global space</title> + <title>ã°ãã¼ãã«ç©ºé</title> <para> - Without any namespace definition, all class and function definitions are - placed into the global space - as it was in PHP before namespaces were - supported. Prefixing a name with <literal>\</literal> will specify that - the name is required from the global space even in the context of the - namespace. + åå空éã®å®ç¾©ããªãå ´åããã¹ã¦ã®ã¯ã©ã¹ã颿°ã®å®ç¾©ã¯ã°ãã¼ãã«ç©ºéã«é ç½®ããã¾ãã + ããã¯ãåå空éã«å¯¾å¿ããåã® PHP ããµãã¼ããã¦ãã空éã§ãã + ååã®å é ã« <literal>\</literal> ãã¤ããã¨ã + åå空éã®å é¨ããã§ãã£ã¦ãã°ãã¼ãã«ç©ºéã®ååãæå®ãããã¨ãã§ãã¾ãã <example> - <title>Using global space specification</title> + <title>ã°ãã¼ãã«ç©ºéãæå®ããæ¹æ³</title> <programlisting role="php"> <![CDATA[ <?php namespace A\B\C; -/* This function is A\B\C\fopen */ +/* ãã®é¢æ°ã¯ A\B\C\fopen ã§ã */ function fopen() { /* ... */ - $f = \fopen(...); // call global fopen + $f = \fopen(...); // ã°ãã¼ãã«ãª fopen ãã³ã¼ã«ãã¾ã return $f; } ?> @@ -707,22 +709,23 @@ </para> </sect1> <sect1 xml:id="language.namespaces.fallback"> - <title>Using namespaces: fallback to global function/constant</title> + <title>åå空éã®ä½¿ç¨æ³: ã°ãã¼ãã«é¢æ°/宿°ã¸ã®ç§»è¡</title> <para> - Inside a namespace, when PHP encounters a unqualified Name in a class name, function or - constant context, it resolves these with different priorities. Class names always - resolve to the current namespace name. Thus to access internal or non-namespaced - user classes, One must refer to them with their fully qualified Name as in: + åå空éå ã§ãPHP ãæªå®ç¾©ã®ã¯ã©ã¹åã颿°ã宿°ã«åºä¼ã£ãå ´åã + ããããã«å¿ãã¦ç°ãªãåªå é ä½ã§è§£æ±ºãè¡ãã¾ãã + ã¯ã©ã¹åã¯ã常ã«ç¾å¨ã®åå空éã§ã®ååã¨ãã¦è§£éããã¾ãã + ãããã£ã¦ãå é¨ã¯ã©ã¹ãããã¯åå空éã«å±ããªãã¯ã©ã¹ã«ã¢ã¯ã»ã¹ããã«ã¯ + 次ã®ããã«å®å ¨ä¿®é£¾åã§æå®ããªããã°ãªãã¾ããã <example> - <title>Accessing global classes inside a namespace</title> + <title>åå空éå ããã®ã°ãã¼ãã«ã¯ã©ã¹ã¸ã®ã¢ã¯ã»ã¹</title> <programlisting role="php"> <![CDATA[ <?php namespace A\B\C; class Exception extends \Exception {} -$a = new Exception('hi'); // $a is an object of class A\B\C\Exception -$b = new \Exception('hi'); // $b is an object of class Exception +$a = new Exception('hi'); // $a 㯠A\B\C\Exception ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã§ã +$b = new \Exception('hi'); // $b 㯠Exception ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã§ã $c = new ArrayObject; // fatal error, class A\B\C\ArrayObject not found ?> @@ -731,10 +734,10 @@ </example> </para> <para> - For functions and constants, PHP will fall back to global functions or constants - if a namespaced function or constant does not exist. + 颿°ã宿°ã®å ´åãåå空éå ã«ãã®é¢æ°ã宿°ãè¦ã¤ãããªããã° + PHP ã¯ã°ãã¼ãã«é¢æ°/宿°ãæ¢ãã¾ãã <example> - <title>global functions/constants fallback inside a namespace</title> + <title>åå空éå ããã®ã°ãã¼ãã«é¢æ°/宿°ã¸ã®ç§»è¡</title> <programlisting role="php"> <![CDATA[ <?php @@ -746,11 +749,11 @@ return \strlen($str) - 1; } -echo E_ERROR, "\n"; // prints "45" -echo INI_ALL, "\n"; // prints "7" - falls back to global INI_ALL +echo E_ERROR, "\n"; // "45" ã¨è¡¨ç¤ºãã¾ã +echo INI_ALL, "\n"; // "7" ã¨è¡¨ç¤ºãã¾ã - ã°ãã¼ãã«ã® INI_ALL ã«ç§»è¡ãã¾ãã -echo strlen('hi'), "\n"; // prints "1" -if (is_array('hi')) { // prints "is not array" +echo strlen('hi'), "\n"; // "1" ã¨è¡¨ç¤ºãã¾ã +if (is_array('hi')) { // "is not array" ã¨è¡¨ç¤ºãã¾ã echo "is array\n"; } else { echo "is not array\n"; @@ -763,200 +766,199 @@ </sect1> <sect1 xml:id="language.namespaces.rules"> - <title>Name resolution rules</title> + <title>åå解決ã®ã«ã¼ã«</title> <para> - For the purposes of these resolution rules, here are some important definitions: + åå解決ã®ã«ã¼ã«ã説æããã«ããã£ã¦ãããã¤ãã®éè¦ãªå®ç¾©ã示ãã¦ããã¾ãã <variablelist> - <title>Namespace name definitions</title> + <title>åå空éåã®å®ç¾©</title> <varlistentry> - <term>Unqualified name</term> + <term>é修飾å</term> <listitem> <para> - This is an identifier without a namespace separator, such as <literal>Foo</literal> + ããã¯åå空éåºåãæåãå«ã¾ãªãèå¥åã§ã<literal>Foo</literal> ã®ãããªãã®ã§ãã </para> </listitem> </varlistentry> <varlistentry> - <term>Qualified name</term> + <term>修飾å</term> <listitem> <para> - This is an identifier with a namespace separator, such as <literal>Foo\Bar</literal> + ããã¯åå空éåºåãæåãå«ãèå¥åã§ã<literal>Foo\Bar</literal> ã®ãããªãã®ã§ãã </para> </listitem> </varlistentry> <varlistentry> - <term>Fully qualified name</term> + <term>å®å ¨ä¿®é£¾å</term> <listitem> <para> - This is an identifier with a namespace separator that begins with a namespace - separator, such as <literal>\Foo\Bar</literal>. <literal>namespace\Foo</literal> - is also a fully qualified name. + ããã¯åå空éåºåãæåãå«ãèå¥åã®ãã¡å é ãåå空éåºåãæåã§å§ã¾ããã®ã§ã + <literal>\Foo\Bar</literal> ã®ãããªãã®ã§ãã<literal>namespace\Foo</literal> + ãå®å ¨ä¿®é£¾åã§ãã </para> </listitem> </varlistentry> </variablelist> </para> <para> - Names are resolved following these resolution rules: + åå解決ã¯ããããã®è§£æ±ºã«ã¼ã«ã«ãã£ã¦è¡ããã¾ãã <orderedlist> <listitem> <simpara> - Calls to fully qualified functions, classes or constants are resolved at compile-time. - For instance <literal>new \A\B</literal> resolves to class <literal>A\B</literal>. + å®å ¨ä¿®é£¾ããã颿°ãã¯ã©ã¹ã宿°ã¸ã®ã³ã¼ã«ã¯ã³ã³ãã¤ã«æã«è§£æ±ºããã¾ãã + ãã¨ãã°ã<literal>new \A\B</literal> 㯠<literal>A\B</literal> ã¯ã©ã¹ã¨è§£éããã¾ãã </simpara> </listitem> <listitem> <simpara> - All unqualified and qualified names (not fully qualified names) are translated during - compilation according to current - import rules. For example, if the namespace <literal>A\B\C</literal> is imported as - <literal>C</literal>, a call to - <literal>C\D\e()</literal> is translated to <literal>A\B\C\D\e()</literal>. + é修飾åããã³ (å®å ¨ä¿®é£¾ã§ãªã) 修飾åã®å¤æã¯ãç¾å¨ã®ã¤ã³ãã¼ãã«ã¼ã«ã«åºã¥ãã¦ã³ã³ãã¤ã«æã«è¡ããã¾ãã + ãã¨ãã°ãåå空é <literal>A\B\C</literal> ã + <literal>C</literal> ã¨ããååã§ã¤ã³ãã¼ãããã¦ããå ´åã + <literal>C\D\e()</literal> ã¸ã®ã³ã¼ã«ã¯ <literal>A\B\C\D\e()</literal> + ã¨å¤æããã¾ãã </simpara> </listitem> <listitem> <simpara> - Inside a namespace, all qualified names not translated according to import - rules have the current namespace prepended. For example, if a call - to <literal>C\D\e()</literal> is performed within namespace <literal>A\B</literal>, - it is translated to <literal>A\B\C\D\e()</literal>. + åå空éå ã§ãã¤ã³ãã¼ãã«ã¼ã«ã«ãã夿ãè¡ãããªãã£ã修飾å㯠+ ç¾å¨ã®åååºéãå é ã«ä»å ããã¾ãããã¨ãã°ã + <literal>C\D\e()</literal> ã¸ã®ã³ã¼ã«ãåå空é <literal>A\B</literal> + å ã§è¡ãããå ´åããã㯠<literal>A\B\C\D\e()</literal> ã«å¤æããã¾ãã </simpara> </listitem> <listitem> <simpara> - Unqualified class names are translated during compilation according to current - import rules (full name substituted for short imported name). In example, if - the namespace <literal>A\B\C</literal> is imported as C, <literal>new C()</literal> is - translated to <literal>new A\B\C()</literal>. + é修飾ã¯ã©ã¹åã®å¤æã¯ãç¾å¨ã®ã¤ã³ãã¼ãã«ã¼ã«ã«åºã¥ãã¦ã³ã³ãã¤ã«æã«è¡ããã¾ã + (ãã«ãã¼ã ããã¤ã³ãã¼ããããçãååã«ç½®ãæãããã¾ã)ããã¨ãã°ã + åå空é <literal>A\B\C</literal> ã C ã¨ããååã§ã¤ã³ãã¼ãããã¦ããå ´åã + <literal>new C()</literal> 㯠<literal>new A\B\C()</literal> ã¨å¤æããã¾ãã </simpara> </listitem> <listitem> <simpara> - Inside namespace (say A\B), calls to unqualified functions are resolved at run-time. - Here is how a - call to function <literal>foo()</literal> is resolved: + åå空éå (ããã§ã¯ A\B ã¨ãã¾ããã) ã§ãé修飾ãªé¢æ°ã¸ã®ã³ã¼ã«ã¯å®è¡æã«è§£æ±ºããã¾ãã + 颿° <literal>foo()</literal> ã®ã³ã¼ã«ã¯ã次ã®ããã«è§£æ±ºããã¾ãã </simpara> <orderedlist> <listitem> <simpara> - It looks for a function from the current namespace: - <literal>A\B\foo()</literal>. + ã¾ãç¾å¨ã®åå空éãã颿° + <literal>A\B\foo()</literal> ãæ¢ãã¾ãã </simpara> </listitem> <listitem> <simpara> - It tries to find and call the <emphasis>global</emphasis> function - <literal>foo()</literal>. + 次㫠<emphasis>ã°ãã¼ãã«</emphasis> 颿° + <literal>foo()</literal> ãæ¢ãã¾ãã </simpara> </listitem> </orderedlist> </listitem> <listitem> <simpara> - Inside namespace (say <literal>A\B</literal>), calls to unqualified or qualified - class names (not fully qualified class names) - are resolved at run-time. Here is how a call to - <literal>new C()</literal> or <literal>new D\E()</literal> is resolved. - For <literal> new C()</literal>: + åå空éå (ããã§ã¯ <literal>A\B</literal> ã¨ãã¾ããã) ã§ã + é修飾ããã㯠(å®å ¨ä¿®é£¾ã§ãªã) 修飾ãªã¯ã©ã¹ã¸ã®ã³ã¼ã«ã¯å®è¡æã«è§£æ±ºããã¾ãã + <literal>new C()</literal> ã <literal>new D\E()</literal> + ãã©ã®ããã«è§£æ±ºããããã示ãã¾ãã + <literal> new C()</literal> ã®å ´åã¯ã </simpara> <orderedlist> <listitem> <simpara> - It looks for a class from the current namespace: - <literal>A\B\C</literal>. + ã¾ãç¾å¨ã®åå空éããã¯ã©ã¹ + <literal>A\B\C</literal> ãæ¢ãã¾ãã </simpara> </listitem> <listitem> <simpara> - It attemts to autoload <literal>A\B\C</literal>. + <literal>A\B\C</literal> ã autoload ãã¾ãã </simpara> </listitem> </orderedlist> <simpara> - For <literal> new D\E()</literal>: + <literal> new D\E()</literal> ã®å ´åã¯ã </simpara> <orderedlist> <listitem> <simpara> - It looks for a class by prepending the current namespace: - <literal>A\B\D\E</literal>. + ç¾å¨ã®åå空éãå é ã«ã¤ãã + <literal>A\B\D\E</literal> ãæ¢ãã¾ãã </simpara> </listitem> <listitem> <simpara> - It attemts to autoload <literal>A\B\D\E</literal>. + <literal>A\B\D\E</literal> ã autoload ãã¾ãã </simpara> </listitem> </orderedlist> <simpara> - To reference any global class in the global namespace, - its fully qualified name <literal>new \C()</literal> must be used. + ã°ãã¼ãã«åå空éå ã®ã°ãã¼ãã«ã¯ã©ã¹ãåç §ããã«ã¯ãå®å ¨ä¿®é£¾å½¢å¼ã® + <literal>new \C()</literal> ã使ããªããã°ãªãã¾ããã </simpara> </listitem> </orderedlist> </para> <example> - <title>Name resolutions illustrated</title> + <title>åå解決ã®ä¾</title> <programlisting role="php"> <![CDATA[ <?php namespace A; use B\D, C\E as F; -// function calls +// 颿°ã®ã³ã¼ã« -foo(); // first tries to call "foo" defined in namespace "A" - // then calls global function "foo" +foo(); // ã¾ãåå空é "A" ã§å®ç¾©ããã¦ãã "foo" ã®ã³ã¼ã«ã試ã¿ã + // 次ã«ã°ãã¼ãã«é¢æ° "foo" ãã³ã¼ã«ãã¾ã -\foo(); // calls function "foo" defined in global scope +\foo(); // ã°ãã¼ãã«ã¹ã³ã¼ãã§å®ç¾©ããã¦ãã颿° "foo" ãã³ã¼ã«ãã¾ã -my\foo(); // calls function "foo" defined in namespace "A\my" +my\foo(); // åå空é "A\my" ã§å®ç¾©ããã¦ãã颿° "foo" ãã³ã¼ã«ãã¾ã -F(); // first tries to call "F" defined in namespace "A" - // then calls global function "F" +F(); // ã¾ãåå空é "A" ã§å®ç¾©ããã¦ãã "F" ã®ã³ã¼ã«ã試ã¿ã + // 次ã«ã°ãã¼ãã«é¢æ° "F" ãã³ã¼ã«ãã¾ã -// class references +// ã¯ã©ã¹ã®åç § -new B(); // creates object of class "B" defined in namespace "A" - // if not found, it tries to autoload class "A\B" +new B(); // åå空é "A" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "B" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "A\B" ã® autoload ã試ã¿ã¾ã -new D(); // using import rules, creates object of class "D" defined in namespace "B" - // if not found, it tries to autoload class "B\D" +new D(); // ã¤ã³ãã¼ãã«ã¼ã«ã使ç¨ããåå空é "B" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "D" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "B\D" ã® autoload ã試ã¿ã¾ã -new F(); // using import rules, creates object of class "E" defined in namespace "C" - // if not found, it tries to autoload class "C\E" +new F(); // ã¤ã³ãã¼ãã«ã¼ã«ã使ç¨ããåå空é "C" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "E" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "C\E" ã® autoload ã試ã¿ã¾ã -new \B(); // creates object of class "B" defined in global scope - // if not found, it tries to autoload class "B" +new \B(); // ã°ãã¼ãã«ã¹ã³ã¼ãã§å®ç¾©ããã¦ããã¯ã©ã¹ "B" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "B" ã® autoload ã試ã¿ã¾ã -new \D(); // creates object of class "D" defined in global scope - // if not found, it tries to autoload class "D" +new \D(); // ã°ãã¼ãã«ã¹ã³ã¼ãã§å®ç¾©ããã¦ããã¯ã©ã¹ "D" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "D" ã® autoload ã試ã¿ã¾ã -new \F(); // creates object of class "F" defined in global scope - // if not found, it tries to autoload class "F" +new \F(); // ã°ãã¼ãã«ã¹ã³ã¼ãã§å®ç¾©ããã¦ããã¯ã©ã¹ "F" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "F" ã® autoload ã試ã¿ã¾ã -// static methods/namespace functions from another namespace +// å¥ã®åå空éãã使ç¨ããéçã¡ã½ãã/颿° -B\foo(); // calls function "foo" from namespace "A\B" +B\foo(); // åå空é "A\B" ã®é¢æ° "foo" ãã³ã¼ã«ãã¾ã -B::foo(); // calls method "foo" of class "B" defined in namespace "A" - // if class "A\B" not found, it tries to autoload class "A\B" +B::foo(); // åå空é "A" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "B" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "A\B" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "A\B" ã® autoload ã試ã¿ã¾ã -D::foo(); // using import rules, calls method "foo" of class "D" defined in namespace "B" - // if class "B\D" not found, it tries to autoload class "B\D" +D::foo(); // ã¤ã³ãã¼ãã«ã¼ã«ã使ç¨ããåå空é "B" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "D" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "B\D" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "B\D" ã® autoload ã試ã¿ã¾ã -\B\foo(); // calls function "foo" from namespace "B" +\B\foo(); // åå空é "B" ã®é¢æ° "foo" ãã³ã¼ã«ãã¾ã -\B::foo(); // calls method "foo" of class "B" from global scope - // if class "B" not found, it tries to autoload class "B" +\B::foo(); // ã°ãã¼ãã«ã¹ã³ã¼ãã®ã¯ã©ã¹ "B" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "B" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "B" ã® autoload ã試ã¿ã¾ã -// static methods/namespace functions of current namespace +// ç¾å¨ã®åå空éãã使ç¨ããéçã¡ã½ãã/颿° -A\B::foo(); // calls method "foo" of class "B" from namespace "A\A" - // if class "A\A\B" not found, it tries to autoload class "A\A\B" +A\B::foo(); // åå空é "A\A" ã®ã¯ã©ã¹ "B" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "A\A\B" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "A\A\B" ã® autoload ã試ã¿ã¾ã -\A\B::foo(); // calls method "foo" of class "B" from namespace "A\B" - // if class "A\B" not found, it tries to autoload class "A\B" +\A\B::foo(); // åå空é "A\B" ã®ã¯ã©ã¹ "B" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "A\B" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "A\B" ã® autoload ã試ã¿ã¾ã ?> ]]> </programlisting>
http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/soap/soapclient/gettypes.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-ja/reference/soap/soapclient/gettypes.xml diff -u phpdoc-ja/reference/soap/soapclient/gettypes.xml:1.1 phpdoc-ja/reference/soap/soapclient/gettypes.xml:1.2 --- phpdoc-ja/reference/soap/soapclient/gettypes.xml:1.1 Mon Feb 23 03:04:32 2009 +++ phpdoc-ja/reference/soap/soapclient/gettypes.xml Wed Mar 11 03:41:08 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> <!-- CREDITS: hirokawa,shimooka --> <refentry xml:id="soapclient.gettypes" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/soap/soapclient/getlastresponse.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-ja/reference/soap/soapclient/getlastresponse.xml diff -u phpdoc-ja/reference/soap/soapclient/getlastresponse.xml:1.1 phpdoc-ja/reference/soap/soapclient/getlastresponse.xml:1.2 --- phpdoc-ja/reference/soap/soapclient/getlastresponse.xml:1.1 Mon Feb 23 03:04:32 2009 +++ phpdoc-ja/reference/soap/soapclient/getlastresponse.xml Wed Mar 11 03:41:08 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <!-- CREDITS: hirokawa,shimooka --> <refentry xml:id="soapclient.getlastresponse" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> @@ -48,7 +48,7 @@ <?php $client = SoapClient("some.wsdl", array('trace' => 1)); $result = $client->SomeFunction(); -echo "REsponse:\n" . $client->__getLastResponse() . "\n"; +echo "Response:\n" . $client->__getLastResponse() . "\n"; ?> ]]> </programlisting> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/pcre/pattern.syntax.xml?r1=1.18&r2=1.19&diff_format=u Index: phpdoc-ja/reference/pcre/pattern.syntax.xml diff -u phpdoc-ja/reference/pcre/pattern.syntax.xml:1.18 phpdoc-ja/reference/pcre/pattern.syntax.xml:1.19 --- phpdoc-ja/reference/pcre/pattern.syntax.xml:1.18 Fri Jan 9 00:13:41 2009 +++ phpdoc-ja/reference/pcre/pattern.syntax.xml Wed Mar 11 03:41:08 2009 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.18 $ --> +<!-- $Revision: 1.19 $ --> <!-- splitted from ./ja/functions/pcre.xml, last change in rev 1.1 --> -<!-- EN-Revision: 1.23 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: 1.24 Maintainer: hirokawa Status: ready --> <!-- Credits: haruki --> <chapter xml:id="reference.pcre.pattern.syntax" xmlns="http://docbook.org/ns/docbook"> <title>ãã¿ã¼ã³æ§æ</title> @@ -908,6 +908,8 @@ \, -, (å§ç«¯ã®)^ ããã³çµç«¯ã® ] 以å¤ã®ãã¹ã¦ã®éè±æ°åã¯ã æåã¯ã©ã¹ã«ããã¦ç¹å¥ãªæå³ãæããªãæåã§ããã ã¨ã¹ã±ã¼ããã¦ãåé¡ã¯ããã¾ããã + ãã¿ã¼ã³ã®çµç«¯æåã¯å¸¸ã«ç¹å¥æ±ããããã®ã§ã + æ£è¦è¡¨ç¾å ã§ç§ç¨ããå ´åã¯å¿ ãã¨ã¹ã±ã¼ãããªããã°ãªãã¾ããã </para> </section> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/msql/functions/msql-pconnect.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc-ja/reference/msql/functions/msql-pconnect.xml diff -u phpdoc-ja/reference/msql/functions/msql-pconnect.xml:1.5 phpdoc-ja/reference/msql/functions/msql-pconnect.xml:1.6 --- phpdoc-ja/reference/msql/functions/msql-pconnect.xml:1.5 Fri Jun 22 14:32:16 2007 +++ phpdoc-ja/reference/msql/functions/msql-pconnect.xml Wed Mar 11 03:41:08 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.9 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.10 Maintainer: hirokawa Status: ready --> <!-- CREDITS: takagi --> <refentry xml:id="function.msql-pconnect" xmlns="http://docbook.org/ns/docbook"> <refnamediv> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml diff -u phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml:1.1 phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml:1.2 --- phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml:1.1 Thu Feb 12 03:50:32 2009 +++ phpdoc-ja/reference/datetime/datetimezone/gettransitions.xml Wed Mar 11 03:41:08 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> <refentry xml:id="datetimezone.gettransitions" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> @@ -55,6 +55,31 @@ </para> </refsect1> + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.3.0</entry> + <entry> + ãªãã·ã§ã³ã® <parameter>timestamp_begin</parameter> ããã³ <parameter>timestamp_end</parameter> + ã追å ããã¾ããã + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + <refsect1 role="examples"> &reftitle.examples; <para> http://cvs.php.net/viewvc.cgi/phpdoc-ja/language/namespaces.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc-ja/language/namespaces.xml diff -u phpdoc-ja/language/namespaces.xml:1.7 phpdoc-ja/language/namespaces.xml:1.8 --- phpdoc-ja/language/namespaces.xml:1.7 Sun Mar 8 10:01:49 2009 +++ phpdoc-ja/language/namespaces.xml Wed Mar 11 03:41:08 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- EN-Revision: 1.10 Maintainer: takagi Status: working --> <chapter xml:id="language.namespaces" xmlns="http://docbook.org/ns/docbook" version="1.1"> @@ -59,7 +59,7 @@ $a = new MyClass; $c = new \my\name\MyClass; // "ã°ãã¼ãã«ç©ºé" ãåç §ãã ãã -$a = strlen('hi'); // "åå空éã®ä½¿ç¨æ³: ã°ãã¼ãã«é¢æ°ã夿°ã¸ã® +$a = strlen('hi'); // "åå空éã®ä½¿ç¨æ³: ã°ãã¼ãã«é¢æ°/宿°ã¸ã® // ç§»è¡" ãåç §ãã ãã $d = namespace\MYCONST; // "namespace æ¼ç®åããã³ __NAMESPACE__ 宿°" @@ -257,75 +257,79 @@ </para> </sect1> <sect1 xml:id="language.namespaces.basics"> - <title>Using namespaces: Basics</title> + <title>åå空éã®ä½¿ç¨æ³: åºæ¬ç·¨</title> <para> - Before discussing the use of namespaces, it is important to understand how PHP - knows which namespaced element your code is requesting. A simple analogy can be made - between PHP namespaces and a filesystem. There are three ways to access a file in a - file system: + åå空éã®ä½¿ãæ¹ã«ã¤ãã¦ããããè¨ãåã«ãã¾ã㯠+ PHP ãã©ã®ããã«ãã¦ã³ã¼ãä¸ã®è¦ç´ ã®åå空éãç¥ãã®ããçè§£ãã¦ãããã¨ãéè¦ã§ãã + PHP ã®åå空éã¯ããã¡ã¤ã«ã·ã¹ãã ã«ãã¨ãã¦èãããã¨ãã§ãã¾ãã + ãã¨ãã°ããã¡ã¤ã«ã·ã¹ãã å ã®ãã¡ã¤ã«ã«ã¢ã¯ã»ã¹ããã«ã¯æ¬¡ã® 3 ã¤ã®æ¹æ³ãããã¾ãã <orderedlist> <listitem> <simpara> - Relative file name like <literal>foo.txt</literal>. This resolves to - <literal>currentdirectory/foo.txt</literal> where currentdirectory is the - directory currently occupied. So if the current directory is - <literal>/home/foo</literal>, the name resolves to <literal>/home/foo/foo.txt</literal>. + <literal>foo.txt</literal> ã®ãããªç¸å¯¾ãã¡ã¤ã«åã使ãããã㯠+ <literal>currentdirectory/foo.txt</literal> ã¨è§£éããã¾ããããã§ã + currentdirectory ã¯ç¾å¨ãããã£ã¬ã¯ããªã表ãã¾ãããããã£ã¦ãã«ã¬ã³ããã£ã¬ã¯ããªã + <literal>/home/foo</literal> ã§ãã£ãå ´åã¯ãã㯠<literal>/home/foo/foo.txt</literal> + ã¨ãªãã¾ãã </simpara> </listitem> <listitem> <simpara> - Relative path name like <literal>subdirectory/foo.txt</literal>. This resolves - to <literal>currentdirectory/subdirectory/foo.txt</literal>. + <literal>subdirectory/foo.txt</literal> ã®ãããªç¸å¯¾ãã¹åã使ãããã㯠+ <literal>currentdirectory/subdirectory/foo.txt</literal> ã¨è§£éããã¾ãã </simpara> </listitem> <listitem> <simpara> - Absolute path name like <literal>/main/foo.txt</literal>. This resolves - to <literal>/main/foo.txt</literal>. + <literal>/main/foo.txt</literal> ã®ãããªçµ¶å¯¾ãã¹åã使ãããã㯠+ <literal>/main/foo.txt</literal> ã¨è§£éããã¾ãã </simpara> </listitem> </orderedlist> - The same principle can be applied to namespaced elements in PHP. For - example, a class name can be referred to in three ways: + PHP ã®åå空éå ã®è¦ç´ ã«ã¤ãã¦ãåãçå±ããã¦ã¯ã¾ãã¾ãã + ãã¨ãã°ãã¯ã©ã¹åãåç §ããã«ã¯æ¬¡ã® 3 ã¤ã®æ¹æ³ãããã¾ãã <orderedlist> <listitem> <simpara> - Unqualified name, or an unprefixed class name like - <literal>$a = new foo();</literal> or - <literal>foo::staticmethod();</literal>. If the current namespace is - <literal>currentnamespace</literal>, this resolves to - <literal>currentnamespace\foo</literal>. If - the code is global, non-namespaced code, this resolves to <literal>foo</literal>. + <literal>$a = new foo();</literal> ããã㯠+ <literal>foo::staticmethod();</literal> ã®ãããªé修飾å + ãããã¯ãã¬ãã£ãã¯ã¹ãªãã®ã¯ã©ã¹åã + ç¾å¨ã®åå空éã <literal>currentnamespace</literal> ã§ããå ´åããã㯠+ <literal>currentnamespace\foo</literal> ã¨è§£éããã¾ãã + åå空éã«å±ããªãã°ãã¼ãã«ãªã³ã¼ãã«ããã¦ã¯ããã㯠+ <literal>foo</literal> ã¨è§£éããã¾ãã </simpara> <simpara> - One caveat: unqualified names for functions and constants will - resolve to global functions and constants if the namespaced function or constant - is not defined. See <link linkend="language.namespaces.fallback">Using namespaces: - fallback to global function/constant</link> for details. + 注æ: 修飾ããã¦ããªã颿°ã宿°ã¯ãåå空éå ã«ãã®é¢æ°ã宿°ããªããã° + ã°ãã¼ãã«ãªé¢æ°ãããã¯å¤æ°ã¨ã¿ãªããã¾ãã詳細㯠+ <link linkend="language.namespaces.fallback">åå空éã®ä½¿ç¨æ³: + ã°ãã¼ãã«ãªé¢æ°/宿°ã¸ã®ç§»è¡</link> ãåç §ãã ããã </simpara> </listitem> <listitem> <simpara> - Qualified name, or a prefixed class name like - <literal>$a = new subnamespace\foo();</literal> or - <literal>subnamespace\foo::staticmethod();</literal>. If the current namespace is - <literal>currentnamespace</literal>, this resolves to - <literal>currentnamespace\subnamespace\foo</literal>. If - the code is global, non-namespaced code, this resolves to <literal>subnamespace\foo</literal>. + <literal>$a = new subnamespace\foo();</literal> ããã㯠+ <literal>subnamespace\foo::staticmethod();</literal> ã®ãããªä¿®é£¾å + ãããã¯ãã¬ãã£ãã¯ã¹ã¤ãã¯ã©ã¹åã + ç¾å¨ã®åå空éã <literal>currentnamespace</literal> ã§ããå ´åããã㯠+ <literal>currentnamespace\subnamespace\foo</literal> ã¨è§£éããã¾ãã + åå空éã«å±ããªãã°ãã¼ãã«ãªã³ã¼ãã«ããã¦ã¯ããã㯠+ <literal>subnamespace\foo</literal> ã¨è§£éããã¾ãã </simpara> </listitem> <listitem> <simpara> - Fully qualified name, or a prefixed name with global prefix operator like - <literal>$a = new \currentnamespace\foo();</literal> or - <literal>\currentnamespace\foo::staticmethod();</literal>. This always resolves - to the literal name specified in the code, <literal>currentnamespace\foo</literal>. + <literal>$a = new \currentnamespace\foo();</literal> ããã㯠+ <literal>\currentnamespace\foo::staticmethod();</literal> ã®ãããªå®å ¨ä¿®é£¾å + ãããã¯ã°ãã¼ãã«ãã¬ãã£ãã¯ã¹æ¼ç®åã¤ãã®ã¯ã©ã¹åã + ããã¯ã常ã«ã³ã¼ãã§è¨è¿°ãããã¨ããã®ååã§ãã + <literal>currentnamespace\foo</literal> ã¨è§£éããã¾ãã </simpara> </listitem> </orderedlist> </para> <para> - Here is an example of the three kinds of syntax in actual code: + ããã 3 ã¤ã®æ§æãå®éã®ã³ã¼ãã§ä½¿ãä¾ã次ã«ç¤ºãã¾ãã <informalexample> <simpara>file1.php</simpara> <programlisting role="php"> @@ -356,33 +360,32 @@ static function staticmethod() {} } -/* Unqualified name */ -foo(); // resolves to function Foo\Bar\foo -foo::staticmethod(); // resolves to class Foo\Bar\foo, method staticmethod -echo FOO; // resolves to constant Foo\Bar\FOO - -/* Qualified name */ -subnamespace\foo(); // resolves to function Foo\Bar\subnamespace\foo -subnamespace\foo::staticmethod(); // resolves to class Foo\Bar\subnamespace\foo, - // method staticmethod -echo subnamespace\FOO; // resolves to constant Foo\Bar\subnamespace\FOO +/* é修飾å */ +foo(); // Foo\Bar\foo 颿°ã¨è§£éããã¾ã +foo::staticmethod(); // Foo\Bar\foo ã¯ã©ã¹ã® staticmethod ã¡ã½ããã¨è§£éããã¾ã +echo FOO; // 宿° Foo\Bar\FOO ã¨è§£éããã¾ã + +/* 修飾å */ +subnamespace\foo(); // Foo\Bar\subnamespace\foo 颿°ã¨è§£éããã¾ã +subnamespace\foo::staticmethod(); // Foo\Bar\subnamespace\foo ã¯ã©ã¹ã® + // staticmethod ã¡ã½ããã¨è§£éããã¾ã +echo subnamespace\FOO; // 宿° Foo\Bar\subnamespace\FOO ã¨è§£éããã¾ã -/* Fully qualified name */ -\Foo\Bar\foo(); // resolves to function Foo\Bar\foo -\Foo\Bar\foo::staticmethod(); // resolves to class Foo\Bar\foo, method staticmethod -echo \Foo\Bar\FOO; // resolves to constant Foo\Bar\FOO +/* å®å ¨ä¿®é£¾å */ +\Foo\Bar\foo(); // Foo\Bar\foo 颿°ã¨è§£éããã¾ã +\Foo\Bar\foo::staticmethod(); // Foo\Bar\foo ã¯ã©ã¹ã® staticmethod ã¡ã½ããã¨è§£éããã¾ã +echo \Foo\Bar\FOO; // 宿° Foo\Bar\FOO ã¨è§£éããã¾ã ?> ]]> </programlisting> </informalexample> </para> <para> - Note that to access any global - class, function or constant, a fully qualified name can be used, such as - <function>\strlen</function> or <classname>\Exception</classname> or - <literal>\INI_ALL</literal>. + ã°ãã¼ãã«ãªã¯ã©ã¹ã颿°ãããã¯å®æ°ã«ã¢ã¯ã»ã¹ããã«ã¯ãå®å ¨ä¿®é£¾åã使ç¨ã㦠+ <function>\strlen</function>ã<classname>\Exception</classname> ããã㯠+ <literal>\INI_ALL</literal> ãªã©ã¨ãããã¨ãã§ãã¾ãã <example> - <title>Accessing global classes, functions and constants from within a namespace</title> + <title>ã°ãã¼ãã«ãªã¯ã©ã¹ã颿°ããã³å®æ°ã¸ã®åå空éå ããã®ã¢ã¯ã»ã¹</title> <programlisting role="php"> <![CDATA[ <?php @@ -392,9 +395,9 @@ const INI_ALL = 3; class Exception {} -$a = \strlen('hi'); // calls global function strlen -$b = \INI_ALL; // accesses global constant INI_ALL -$c = new \Exception('error'); // instantiates global class Exception +$a = \strlen('hi'); // ã°ãã¼ãã«é¢æ° strlen ãã³ã¼ã«ãã¾ã +$b = \INI_ALL; // ã°ãã¼ãã«å®æ° INI_ALL ã«ã¢ã¯ã»ã¹ãã¾ã +$c = new \Exception('error'); // ã°ãã¼ãã«ã¯ã©ã¹ Exception ã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã ?> ]]> </programlisting> @@ -402,12 +405,12 @@ </para> </sect1> <sect1 xml:id="language.namespaces.dynamic"> - <title>Namespaces and dynamic language features</title> + <title>åå空éã¨åçè¨èªæ©è½</title> <para> - PHP's implementation of namespaces is influenced by its dynamic nature as a programming - language. Thus, to convert code like the following example into namespaced code: + PHP ã«ãããåå空éã®å®è£ ã¯ãPHP èªèº«ãåçããã°ã©ãã³ã°è¨èªã§ããã¨ããæ§è³ªã«å½±é¿ãåãã¦ãã¾ãã + ãããã£ã¦ã次ã®ä¾ã®ãããªã³ã¼ããåå空éã使ã£ã¦æ¸ãç´ãã«ã¯ <example> - <title>Dynamically accessing elements</title> + <title>è¦ç´ ã¸ã®åçãªã¢ã¯ã»ã¹</title> <simpara>example1.php:</simpara> <programlisting role="php"> <![CDATA[ @@ -426,20 +429,19 @@ const constname = "global"; $a = 'classname'; -$obj = new $a; // prints classname::__construct +$obj = new $a; // classname::__construct ã¨è¡¨ç¤ºãã¾ã $b = 'funcname'; -$b(); // prints funcname -echo constant('constname'), "\n"; // prints global +$b(); // funcname ã¨è¡¨ç¤ºãã¾ã +echo constant('constname'), "\n"; // global ã¨è¡¨ç¤ºãã¾ã ?> ]]> </programlisting> </example> - One must use the fully qualified name (class name with namespace prefix). - Note that because there is no difference between a qualified and a fully qualified Name - inside a dynamic class name, function name, or constant name, the leading backslash is - not necessary. + å®å ¨ä¿®é£¾å (ã¯ã©ã¹åã«åå空éãã¬ãã£ãã¯ã¹ãã¤ãããã®) ã使ãå¿ è¦ãããã¾ãã + åçãªã¯ã©ã¹åã颿°åãããã¯å®æ°åã«ããã¦ã¯ä¿®é£¾åã¨å®å ¨ä¿®é£¾åã«å·®ã¯ãªãã®ã§ã + å é ã®ããã¯ã¹ã©ãã·ã¥ã¯ãªãã¦ããã¾ãã¾ããã <example> - <title>Dynamically accessing namespaced elements</title> + <title>åå空éã¤ãè¦ç´ ã¸ã®åçãªã¢ã¯ã»ã¹</title> <programlisting role="php"> <![CDATA[ <?php @@ -460,69 +462,70 @@ include 'example1.php'; $a = 'classname'; -$obj = new $a; // prints classname::__construct +$obj = new $a; // classname::__construct ã¨è¡¨ç¤ºãã¾ã $b = 'funcname'; -$b(); // prints funcname -echo constant('constname'), "\n"; // prints global +$b(); // funcname ã¨è¡¨ç¤ºãã¾ã +echo constant('constname'), "\n"; // global ã¨è¡¨ç¤ºãã¾ã -/* note that if using double quotes, "\\namespacename\\classname" must be used */ +/* ããã«ã¯ã©ã¼ãã使ãå ´å㯠"\\namespacename\\classname" ã¨ããªããã°ãªãã¾ãã */ $a = '\namespacename\classname'; -$obj = new $a; // prints namespacename\classname::__construct +$obj = new $a; // namespacename\classname::__construct ã¨è¡¨ç¤ºãã¾ã $a = 'namespacename\classname'; -$obj = new $a; // also prints namespacename\classname::__construct +$obj = new $a; // ããã namespacename\classname::__construct ã¨è¡¨ç¤ºãã¾ã $b = 'namespacename\funcname'; -$b(); // prints namespacename\funcname +$b(); // namespacename\funcname ã¨è¡¨ç¤ºãã¾ã $b = '\namespacename\funcname'; -$b(); // also prints namespacename\funcname -echo constant('\namespacename\constname'), "\n"; // prints namespaced -echo constant('namespacename\constname'), "\n"; // also prints namespaced +$b(); // ããã namespacename\funcname ã¨è¡¨ç¤ºãã¾ã +echo constant('\namespacename\constname'), "\n"; // namespaced ã¨è¡¨ç¤ºãã¾ã +echo constant('namespacename\constname'), "\n"; // ããã namespaced ã¨è¡¨ç¤ºãã¾ã ?> ]]> </programlisting> </example> </para> <para> - Be sure to read the <link linkend="language.namespaces.faq.quote">note about - escaping namespace names in strings</link>. + <link linkend="language.namespaces.faq.quote"> + æååä¸ã®åå空éåã®ã¨ã¹ã±ã¼ãã«é¢ããæ³¨æ</link> + ãèªãã§ãããã¨ãå¿ããªãããã«ãã¾ãããã </para> </sect1> <sect1 xml:id="language.namespaces.nsconstants"> - <title>namespace keyword and __NAMESPACE__ constant</title> + <title>namespace ãã¼ã¯ã¼ãããã³ __NAMESPACE__ 宿°</title> <para> - PHP supports two ways of abstractly accessing elements within the current namespace, - the <constant>__NAMESPACE__</constant> magic constant, and the <literal>namespace</literal> - keyword. + PHP ã«ã¯ãç¾å¨ã®åå空éå ã®è¦ç´ ã¸ã®ã¢ã¯ã»ã¹ãæ½è±¡åããããã®æ¹æ³ã 2 éãããã¾ãã + ãã¸ãã¯å®æ° <constant>__NAMESPACE__</constant> ããã³ <literal>namespace</literal> + ãã¼ã¯ã¼ããããã§ãã </para> <para> - The value of <constant>__NAMESPACE__</constant> is a string that contains the current - namespace name. In global, un-namespaced code, it contains an empty string. + <constant>__NAMESPACE__</constant> ã®å¤ã¯æååã§ãç¾å¨ã®åå空éã®ååãæ ¼ç´ããã¾ãã + åå空éã«å±ããªãã°ãã¼ãã«ãªã³ã¼ãã§ã¯ããã®ä¸èº«ã¯ç©ºæååã¨ãªãã¾ãã <example> - <title>__NAMESPACE__ example, namespaced code</title> + <title>åå空éå ã®ã³ã¼ãã§ã® __NAMESPACE__ ã®ä¾</title> <programlisting role="php"> <![CDATA[ <?php namespace MyProject; -echo '"', __NAMESPACE__, '"'; // outputs "MyProject" +echo '"', __NAMESPACE__, '"'; // "MyProject" ã¨åºåãã¾ã ?> ]]> </programlisting> </example> <example> - <title>__NAMESPACE__ example, global code</title> + <title>ã°ãã¼ãã«ãªã³ã¼ãã§ã® __NAMESPACE__ ã®ä¾</title> <programlisting role="php"> <![CDATA[ <?php -echo '"', __NAMESPACE__, '"'; // outputs "" +echo '"', __NAMESPACE__, '"'; // "" ã¨åºåãã¾ã ?> ]]> </programlisting> </example> - The <constant>__NAMESPACE__</constant> constant is useful for dynamically constructing - names, for instance: + <constant>__NAMESPACE__</constant> 宿°ã¯ãåçã«ååã使ããå ´åã«ä¾¿å©ã§ãã + ãã¨ãã°æ¬¡ã®ããã«ãªãã¾ãã <example> - <title>using __NAMESPACE__ for dynamic name construction</title> + <title>__NAMESPACE__ ã«ããåçãªååã®ä½æ</title> <programlisting role="php"> <![CDATA[ <?php @@ -539,41 +542,42 @@ </example> </para> <para> - The <literal>namespace</literal> keyword can be used to explicitly request - an element from the current namespace or a sub-namespace. It is the namespace - equivalent of the <literal>self</literal> operator for classes. + <literal>namespace</literal> ãã¼ã¯ã¼ãã使ç¨ããã¨ã + ç¾å¨ã®åå空éãããã¯ãµãåå空éå ã®è¦ç´ ãæç¤ºçã«æå®ãããã¨ãã§ãã¾ãã + ããã¯ãã¯ã©ã¹ã«ããã <literal>self</literal> + æ¼ç®åã¨åãæå³åãã®ãã®ã§ãã <example> - <title>the namespace operator, inside a namespace</title> + <title>åå空éå ã§ã® namespace æ¼ç®å</title> <programlisting role="php"> <![CDATA[ <?php namespace MyProject; -use blah\blah as mine; // see "Using namespaces: importing/aliasing" +use blah\blah as mine; // "åå空éã®ä½¿ç¨æ³: ã¤ã³ãã¼ã/ã¨ã¤ãªã¢ã¹" ãåç §ãã ãã -blah\mine(); // calls function blah\blah\mine() -namespace\blah\mine(); // calls function MyProject\blah\mine() +blah\mine(); // blah\blah\mine() 颿°ãã³ã¼ã«ãã¾ã +namespace\blah\mine(); // MyProject\blah\mine() 颿°ãã³ã¼ã«ãã¾ã -namespace\func(); // calls function MyProject\func() -namespace\sub\func(); // calls function MyProject\sub\func() -namespace\cname::method(); // calls static method "method" of class MyProject\cname -$a = new namespace\sub\cname(); // instantiates object of class MyProject\sub\cname -$b = namespace\CONSTANT; // assigns value of constant MyProject\CONSTANT to $b +namespace\func(); // MyProject\func() 颿°ãã³ã¼ã«ãã¾ã +namespace\sub\func(); // MyProject\sub\func() 颿°ãã³ã¼ã«ãã¾ã +namespace\cname::method(); // MyProject\cname ã¯ã©ã¹ã®éçã¡ã½ãã "method" ãã³ã¼ã«ãã¾ã +$a = new namespace\sub\cname(); // MyProject\sub\cname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$b = namespace\CONSTANT; // 宿° MyProject\CONSTANT ã®å¤ã $b ã«ä»£å ¥ãã¾ã ?> ]]> </programlisting> </example> <example> - <title>the namespace operator, in global code</title> + <title>ã°ãã¼ãã«ã³ã¼ãã§ã® namespace æ¼ç®å</title> <programlisting role="php"> <![CDATA[ <?php -namespace\func(); // calls function func() -namespace\sub\func(); // calls function sub\func() -namespace\cname::method(); // calls static method "method" of class cname -$a = new namespace\sub\cname(); // instantiates object of class sub\cname -$b = namespace\CONSTANT; // assigns value of constant CONSTANT to $b +namespace\func(); // func() 颿°ãã³ã¼ã«ãã¾ã +namespace\sub\func(); // sub\func() 颿°ãã³ã¼ã«ãã¾ã +namespace\cname::method(); // cname ã¯ã©ã¹ã®éçã¡ã½ãã "method" ãã³ã¼ã«ãã¾ã +$a = new namespace\sub\cname(); // sub\cname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$b = namespace\CONSTANT; // 宿° CONSTANT ã®å¤ã $b ã«ä»£å ¥ãã¾ã ?> ]]> </programlisting> @@ -581,98 +585,97 @@ </para> </sect1> <sect1 xml:id="language.namespaces.importing"> - <title>Using namespaces: Aliasing/Importing</title> + <title>åå空éã®ä½¿ç¨æ³: ã¨ã¤ãªã¢ã¹/ã¤ã³ãã¼ã</title> <para> - The ability to refer to an external fully qualified name with an alias, or importing, - is an important feature of namespaces. This is similar to the - ability of unix-based filesystems to create symbolic links to a file or to a directory. + å¤é¨ã®å®å ¨ä¿®é£¾åãã¨ã¤ãªã¢ã¹ã§åç §ãããã¤ã³ãã¼ããããããæ©è½ã¯ã + åå空éã«ããã¦é常ã«éè¦ãªãã®ã§ãã + ããã¯ãUnix ç³»ã®ãã¡ã¤ã«ã·ã¹ãã ã§ãã¡ã¤ã«ããã£ã¬ã¯ããªã¸ã®ã·ã³ããªãã¯ãªã³ã¯ã使ãããã¨ã«ä¼¼ã¦ãã¾ãã </para> <para> - PHP namespaces support - two kinds of aliasing or importing: aliasing a class name, and aliasing a namespace name. - Note that importing a function or constant is not supported. + PHP ã®åå空éã§ã¯ã2 éãã®æ¹æ³ã§ã¨ã¤ãªã¢ã¹ãã¤ã³ãã¼ãããµãã¼ããã¦ãã¾ãã + ã¯ã©ã¹åã®ã¨ã¤ãªã¢ã¹ã使ããæ¹æ³ã¨åå空éåã®ã¨ã¤ãªã¢ã¹ã使ããæ¹æ³ã§ãã + 颿°ã宿°ã®ã¤ã³ãã¼ãã¯ãµãã¼ããã¦ããªããã¨ã«æ³¨æãã¾ãããã </para> <para> - In PHP, aliasing is accomplished with the <literal>use</literal> operator. Here - is an example showing all 3 kinds of importing: + PHP ã§ã®ã¨ã¤ãªã¢ã¹ä½æã«ã¯ <literal>use</literal> æ¼ç®åã使ç¨ãã¾ãã + ããã«ã3 種é¡ãã¹ã¦ã®ã¤ã³ãã¼ãæ¹æ³ã®ä¾ã示ãã¾ãã <example> - <title>importing/aliasing with the use operator</title> + <title>use æ¼ç®åã«ããã¤ã³ãã¼ã/ã¨ã¤ãªã¢ã¹</title> <programlisting role="php"> <![CDATA[ <?php namespace foo; use My\Full\Classname as Another; -// this is the same as use My\Full\NSname as NSname +// ãã㯠use My\Full\NSname as NSname ã¨åãã§ã use My\Full\NSname; -// importing a global class +// ã°ãã¼ãã«ã¯ã©ã¹ãã¤ã³ãã¼ããã¾ã use \ArrayObject; -$obj = new namespace\Another; // instantiates object of class foo\Another -$obj = new Another; // instantiates object of class My\Full\Classname -NSname\subns\func(); // calls function My\Full\NSname\subns\func -$a = new ArrayObject(array(1)); // instantiates object of class ArrayObject -// without the "use \ArrayObject" we would instantiate an object of class foo\ArrayObject +$obj = new namespace\Another; // foo\Another ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$obj = new Another; // My\Full\Classname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +NSname\subns\func(); // My\Full\NSname\subns\func 颿°ãã³ã¼ã«ãã¾ã +$a = new ArrayObject(array(1)); // ArrayObject ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +// "use \ArrayObject" ããªããã°ãfoo\ArrayObject ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãããã¨ã«ãªãã¾ã ?> ]]> </programlisting> </example> - Note that for namespaced names (fully qualified namespace names containing - namespace separator, such as <literal>Foo\Bar</literal> as opposed to global names that - do not, such as <literal>FooBar</literal>), the leading backslash is unnecessary and not - allowed, as import names - must be fully qualified, and are not processed relative to the current namespace. + åå空éã¤ãã®åå (å®å ¨ä¿®é£¾å½¢å¼ã®åå空éã¯åºåãæåãå«ãã + <literal>Foo\Bar</literal> ã®ãããªãã®ã§ãã°ãã¼ãã«ãªå ´åã¯åºåãæåãå«ã¾ãªã + <literal>FooBar</literal> ã®ããã«ãªãã¾ã) + ã§ã¯å é ã®ããã¯ã¹ã©ãã·ã¥ã¯ä¸è¦ã§ã許å¯ãããªããã¨ã«æ³¨æãã¾ãããã + ã¤ã³ãã¼ãããååã¯å®å ¨ä¿®é£¾å½¢å¼ã§ãªããã°ãªããã + ç¾å¨ã®åå空éããã®ç¸å¯¾æå®ã§å¦çããããã¨ã¯ãªãããã§ãã </para> <para> - PHP additionally supports a convenience shortcut to place multiple use statements - on the same line + PHP ã§ã¯ãè¤æ°ã® use æãåä¸è¡ã«ç½®ãããã®ä¾¿å©ãªã·ã§ã¼ãã«ããããµãã¼ããã¦ãã¾ãã <example> - <title>importing/aliasing with the use operator, multiple use statements combined</title> + <title>use æ¼ç®åã«ããã¤ã³ãã¼ã/ã¨ã¤ãªã¢ã¹ã§ãè¤æ°ã® use æãçµã¿åãããä¾</title> <programlisting role="php"> <![CDATA[ <?php use My\Full\Classname as Another, My\Full\NSname; -$obj = new Another; // instantiates object of class My\Full\Classname -NSname\subns\func(); // calls function My\Full\NSname\subns\func +$obj = new Another; // My\Full\Classname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +NSname\subns\func(); // My\Full\NSname\subns\func 颿°ãã³ã¼ã«ãã¾ã ?> ]]> </programlisting> </example> </para> <para> - Importing is performed at compile-time, and so does not affect dynamic class, function - or constant names. + ã¤ã³ãã¼ãã¯ã³ã³ãã¤ã«æã«è¡ãããã®ã§ãåçãªã¯ã©ã¹åã颿°åã宿°åã«ã¯å½±é¿ãåã¼ãã¾ããã <example> - <title>Importing and dynamic names</title> + <title>ã¤ã³ãã¼ãã¨åçå</title> <programlisting role="php"> <![CDATA[ <?php use My\Full\Classname as Another, My\Full\NSname; -$obj = new Another; // instantiates object of class My\Full\Classname +$obj = new Another; // My\Full\Classname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã $a = 'Another'; -$obj = new $a; // instantiates object of class Another +$obj = new $a; // Another ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã ?> ]]> </programlisting> </example> </para> <para> - In addition, importing only affects unqualified and qualified names. Fully qualified - names are absolute, and unaffected by imports. + ããã«ã¤ã³ãã¼ãã®å½±é¿ãåã¶ã®ã¯é修飾åããã³ä¿®é£¾åã®ã¿ã§ãã + å®å ¨ä¿®é£¾åã¯çµ¶å¯¾çãªãã®ã§ãããã¤ã³ãã¼ãã®å½±é¿ãåãããã¨ã¯ããã¾ããã <example> - <title>Importing and fully qualified names</title> + <title>ã¤ã³ãã¼ãã¨å®å ¨ä¿®é£¾å</title> <programlisting role="php"> <![CDATA[ <?php use My\Full\Classname as Another, My\Full\NSname; -$obj = new Another; // instantiates object of class My\Full\Classname -$obj = new \Another; // instantiates object of class Another -$obj = new Another\thing; // instantiates object of class My\Full\Classname\thing -$obj = new \Another\thing; // instantiates object of class Another\thing +$obj = new Another; // My\Full\Classname ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$obj = new \Another; // Another ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$obj = new Another\thing; // My\Full\Classname\thing ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã +$obj = new \Another\thing; // Another\thing ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã®ã¤ã³ã¹ã¿ã³ã¹ã使ãã¾ã ?> ]]> </programlisting> @@ -680,24 +683,23 @@ </para> </sect1> <sect1 xml:id="language.namespaces.global"> - <title>Global space</title> + <title>ã°ãã¼ãã«ç©ºé</title> <para> - Without any namespace definition, all class and function definitions are - placed into the global space - as it was in PHP before namespaces were - supported. Prefixing a name with <literal>\</literal> will specify that - the name is required from the global space even in the context of the - namespace. + åå空éã®å®ç¾©ããªãå ´åããã¹ã¦ã®ã¯ã©ã¹ã颿°ã®å®ç¾©ã¯ã°ãã¼ãã«ç©ºéã«é ç½®ããã¾ãã + ããã¯ãåå空éã«å¯¾å¿ããåã® PHP ããµãã¼ããã¦ãã空éã§ãã + ååã®å é ã« <literal>\</literal> ãã¤ããã¨ã + åå空éã®å é¨ããã§ãã£ã¦ãã°ãã¼ãã«ç©ºéã®ååãæå®ãããã¨ãã§ãã¾ãã <example> - <title>Using global space specification</title> + <title>ã°ãã¼ãã«ç©ºéãæå®ããæ¹æ³</title> <programlisting role="php"> <![CDATA[ <?php namespace A\B\C; -/* This function is A\B\C\fopen */ +/* ãã®é¢æ°ã¯ A\B\C\fopen ã§ã */ function fopen() { /* ... */ - $f = \fopen(...); // call global fopen + $f = \fopen(...); // ã°ãã¼ãã«ãª fopen ãã³ã¼ã«ãã¾ã return $f; } ?> @@ -707,22 +709,23 @@ </para> </sect1> <sect1 xml:id="language.namespaces.fallback"> - <title>Using namespaces: fallback to global function/constant</title> + <title>åå空éã®ä½¿ç¨æ³: ã°ãã¼ãã«é¢æ°/宿°ã¸ã®ç§»è¡</title> <para> - Inside a namespace, when PHP encounters a unqualified Name in a class name, function or - constant context, it resolves these with different priorities. Class names always - resolve to the current namespace name. Thus to access internal or non-namespaced - user classes, One must refer to them with their fully qualified Name as in: + åå空éå ã§ãPHP ãæªå®ç¾©ã®ã¯ã©ã¹åã颿°ã宿°ã«åºä¼ã£ãå ´åã + ããããã«å¿ãã¦ç°ãªãåªå é ä½ã§è§£æ±ºãè¡ãã¾ãã + ã¯ã©ã¹åã¯ã常ã«ç¾å¨ã®åå空éã§ã®ååã¨ãã¦è§£éããã¾ãã + ãããã£ã¦ãå é¨ã¯ã©ã¹ãããã¯åå空éã«å±ããªãã¯ã©ã¹ã«ã¢ã¯ã»ã¹ããã«ã¯ + 次ã®ããã«å®å ¨ä¿®é£¾åã§æå®ããªããã°ãªãã¾ããã <example> - <title>Accessing global classes inside a namespace</title> + <title>åå空éå ããã®ã°ãã¼ãã«ã¯ã©ã¹ã¸ã®ã¢ã¯ã»ã¹</title> <programlisting role="php"> <![CDATA[ <?php namespace A\B\C; class Exception extends \Exception {} -$a = new Exception('hi'); // $a is an object of class A\B\C\Exception -$b = new \Exception('hi'); // $b is an object of class Exception +$a = new Exception('hi'); // $a 㯠A\B\C\Exception ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã§ã +$b = new \Exception('hi'); // $b 㯠Exception ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã§ã $c = new ArrayObject; // fatal error, class A\B\C\ArrayObject not found ?> @@ -731,10 +734,10 @@ </example> </para> <para> - For functions and constants, PHP will fall back to global functions or constants - if a namespaced function or constant does not exist. + 颿°ã宿°ã®å ´åãåå空éå ã«ãã®é¢æ°ã宿°ãè¦ã¤ãããªããã° + PHP ã¯ã°ãã¼ãã«é¢æ°/宿°ãæ¢ãã¾ãã <example> - <title>global functions/constants fallback inside a namespace</title> + <title>åå空éå ããã®ã°ãã¼ãã«é¢æ°/宿°ã¸ã®ç§»è¡</title> <programlisting role="php"> <![CDATA[ <?php @@ -746,11 +749,11 @@ return \strlen($str) - 1; } -echo E_ERROR, "\n"; // prints "45" -echo INI_ALL, "\n"; // prints "7" - falls back to global INI_ALL +echo E_ERROR, "\n"; // "45" ã¨è¡¨ç¤ºãã¾ã +echo INI_ALL, "\n"; // "7" ã¨è¡¨ç¤ºãã¾ã - ã°ãã¼ãã«ã® INI_ALL ã«ç§»è¡ãã¾ãã -echo strlen('hi'), "\n"; // prints "1" -if (is_array('hi')) { // prints "is not array" +echo strlen('hi'), "\n"; // "1" ã¨è¡¨ç¤ºãã¾ã +if (is_array('hi')) { // "is not array" ã¨è¡¨ç¤ºãã¾ã echo "is array\n"; } else { echo "is not array\n"; @@ -763,200 +766,199 @@ </sect1> <sect1 xml:id="language.namespaces.rules"> - <title>Name resolution rules</title> + <title>åå解決ã®ã«ã¼ã«</title> <para> - For the purposes of these resolution rules, here are some important definitions: + åå解決ã®ã«ã¼ã«ã説æããã«ããã£ã¦ãããã¤ãã®éè¦ãªå®ç¾©ã示ãã¦ããã¾ãã <variablelist> - <title>Namespace name definitions</title> + <title>åå空éåã®å®ç¾©</title> <varlistentry> - <term>Unqualified name</term> + <term>é修飾å</term> <listitem> <para> - This is an identifier without a namespace separator, such as <literal>Foo</literal> + ããã¯åå空éåºåãæåãå«ã¾ãªãèå¥åã§ã<literal>Foo</literal> ã®ãããªãã®ã§ãã </para> </listitem> </varlistentry> <varlistentry> - <term>Qualified name</term> + <term>修飾å</term> <listitem> <para> - This is an identifier with a namespace separator, such as <literal>Foo\Bar</literal> + ããã¯åå空éåºåãæåãå«ãèå¥åã§ã<literal>Foo\Bar</literal> ã®ãããªãã®ã§ãã </para> </listitem> </varlistentry> <varlistentry> - <term>Fully qualified name</term> + <term>å®å ¨ä¿®é£¾å</term> <listitem> <para> - This is an identifier with a namespace separator that begins with a namespace - separator, such as <literal>\Foo\Bar</literal>. <literal>namespace\Foo</literal> - is also a fully qualified name. + ããã¯åå空éåºåãæåãå«ãèå¥åã®ãã¡å é ãåå空éåºåãæåã§å§ã¾ããã®ã§ã + <literal>\Foo\Bar</literal> ã®ãããªãã®ã§ãã<literal>namespace\Foo</literal> + ãå®å ¨ä¿®é£¾åã§ãã </para> </listitem> </varlistentry> </variablelist> </para> <para> - Names are resolved following these resolution rules: + åå解決ã¯ããããã®è§£æ±ºã«ã¼ã«ã«ãã£ã¦è¡ããã¾ãã <orderedlist> <listitem> <simpara> - Calls to fully qualified functions, classes or constants are resolved at compile-time. - For instance <literal>new \A\B</literal> resolves to class <literal>A\B</literal>. + å®å ¨ä¿®é£¾ããã颿°ãã¯ã©ã¹ã宿°ã¸ã®ã³ã¼ã«ã¯ã³ã³ãã¤ã«æã«è§£æ±ºããã¾ãã + ãã¨ãã°ã<literal>new \A\B</literal> 㯠<literal>A\B</literal> ã¯ã©ã¹ã¨è§£éããã¾ãã </simpara> </listitem> <listitem> <simpara> - All unqualified and qualified names (not fully qualified names) are translated during - compilation according to current - import rules. For example, if the namespace <literal>A\B\C</literal> is imported as - <literal>C</literal>, a call to - <literal>C\D\e()</literal> is translated to <literal>A\B\C\D\e()</literal>. + é修飾åããã³ (å®å ¨ä¿®é£¾ã§ãªã) 修飾åã®å¤æã¯ãç¾å¨ã®ã¤ã³ãã¼ãã«ã¼ã«ã«åºã¥ãã¦ã³ã³ãã¤ã«æã«è¡ããã¾ãã + ãã¨ãã°ãåå空é <literal>A\B\C</literal> ã + <literal>C</literal> ã¨ããååã§ã¤ã³ãã¼ãããã¦ããå ´åã + <literal>C\D\e()</literal> ã¸ã®ã³ã¼ã«ã¯ <literal>A\B\C\D\e()</literal> + ã¨å¤æããã¾ãã </simpara> </listitem> <listitem> <simpara> - Inside a namespace, all qualified names not translated according to import - rules have the current namespace prepended. For example, if a call - to <literal>C\D\e()</literal> is performed within namespace <literal>A\B</literal>, - it is translated to <literal>A\B\C\D\e()</literal>. + åå空éå ã§ãã¤ã³ãã¼ãã«ã¼ã«ã«ãã夿ãè¡ãããªãã£ã修飾å㯠+ ç¾å¨ã®åååºéãå é ã«ä»å ããã¾ãããã¨ãã°ã + <literal>C\D\e()</literal> ã¸ã®ã³ã¼ã«ãåå空é <literal>A\B</literal> + å ã§è¡ãããå ´åããã㯠<literal>A\B\C\D\e()</literal> ã«å¤æããã¾ãã </simpara> </listitem> <listitem> <simpara> - Unqualified class names are translated during compilation according to current - import rules (full name substituted for short imported name). In example, if - the namespace <literal>A\B\C</literal> is imported as C, <literal>new C()</literal> is - translated to <literal>new A\B\C()</literal>. + é修飾ã¯ã©ã¹åã®å¤æã¯ãç¾å¨ã®ã¤ã³ãã¼ãã«ã¼ã«ã«åºã¥ãã¦ã³ã³ãã¤ã«æã«è¡ããã¾ã + (ãã«ãã¼ã ããã¤ã³ãã¼ããããçãååã«ç½®ãæãããã¾ã)ããã¨ãã°ã + åå空é <literal>A\B\C</literal> ã C ã¨ããååã§ã¤ã³ãã¼ãããã¦ããå ´åã + <literal>new C()</literal> 㯠<literal>new A\B\C()</literal> ã¨å¤æããã¾ãã </simpara> </listitem> <listitem> <simpara> - Inside namespace (say A\B), calls to unqualified functions are resolved at run-time. - Here is how a - call to function <literal>foo()</literal> is resolved: + åå空éå (ããã§ã¯ A\B ã¨ãã¾ããã) ã§ãé修飾ãªé¢æ°ã¸ã®ã³ã¼ã«ã¯å®è¡æã«è§£æ±ºããã¾ãã + 颿° <literal>foo()</literal> ã®ã³ã¼ã«ã¯ã次ã®ããã«è§£æ±ºããã¾ãã </simpara> <orderedlist> <listitem> <simpara> - It looks for a function from the current namespace: - <literal>A\B\foo()</literal>. + ã¾ãç¾å¨ã®åå空éãã颿° + <literal>A\B\foo()</literal> ãæ¢ãã¾ãã </simpara> </listitem> <listitem> <simpara> - It tries to find and call the <emphasis>global</emphasis> function - <literal>foo()</literal>. + 次㫠<emphasis>ã°ãã¼ãã«</emphasis> 颿° + <literal>foo()</literal> ãæ¢ãã¾ãã </simpara> </listitem> </orderedlist> </listitem> <listitem> <simpara> - Inside namespace (say <literal>A\B</literal>), calls to unqualified or qualified - class names (not fully qualified class names) - are resolved at run-time. Here is how a call to - <literal>new C()</literal> or <literal>new D\E()</literal> is resolved. - For <literal> new C()</literal>: + åå空éå (ããã§ã¯ <literal>A\B</literal> ã¨ãã¾ããã) ã§ã + é修飾ããã㯠(å®å ¨ä¿®é£¾ã§ãªã) 修飾ãªã¯ã©ã¹ã¸ã®ã³ã¼ã«ã¯å®è¡æã«è§£æ±ºããã¾ãã + <literal>new C()</literal> ã <literal>new D\E()</literal> + ãã©ã®ããã«è§£æ±ºããããã示ãã¾ãã + <literal> new C()</literal> ã®å ´åã¯ã </simpara> <orderedlist> <listitem> <simpara> - It looks for a class from the current namespace: - <literal>A\B\C</literal>. + ã¾ãç¾å¨ã®åå空éããã¯ã©ã¹ + <literal>A\B\C</literal> ãæ¢ãã¾ãã </simpara> </listitem> <listitem> <simpara> - It attemts to autoload <literal>A\B\C</literal>. + <literal>A\B\C</literal> ã autoload ãã¾ãã </simpara> </listitem> </orderedlist> <simpara> - For <literal> new D\E()</literal>: + <literal> new D\E()</literal> ã®å ´åã¯ã </simpara> <orderedlist> <listitem> <simpara> - It looks for a class by prepending the current namespace: - <literal>A\B\D\E</literal>. + ç¾å¨ã®åå空éãå é ã«ã¤ãã + <literal>A\B\D\E</literal> ãæ¢ãã¾ãã </simpara> </listitem> <listitem> <simpara> - It attemts to autoload <literal>A\B\D\E</literal>. + <literal>A\B\D\E</literal> ã autoload ãã¾ãã </simpara> </listitem> </orderedlist> <simpara> - To reference any global class in the global namespace, - its fully qualified name <literal>new \C()</literal> must be used. + ã°ãã¼ãã«åå空éå ã®ã°ãã¼ãã«ã¯ã©ã¹ãåç §ããã«ã¯ãå®å ¨ä¿®é£¾å½¢å¼ã® + <literal>new \C()</literal> ã使ããªããã°ãªãã¾ããã </simpara> </listitem> </orderedlist> </para> <example> - <title>Name resolutions illustrated</title> + <title>åå解決ã®ä¾</title> <programlisting role="php"> <![CDATA[ <?php namespace A; use B\D, C\E as F; -// function calls +// 颿°ã®ã³ã¼ã« -foo(); // first tries to call "foo" defined in namespace "A" - // then calls global function "foo" +foo(); // ã¾ãåå空é "A" ã§å®ç¾©ããã¦ãã "foo" ã®ã³ã¼ã«ã試ã¿ã + // 次ã«ã°ãã¼ãã«é¢æ° "foo" ãã³ã¼ã«ãã¾ã -\foo(); // calls function "foo" defined in global scope +\foo(); // ã°ãã¼ãã«ã¹ã³ã¼ãã§å®ç¾©ããã¦ãã颿° "foo" ãã³ã¼ã«ãã¾ã -my\foo(); // calls function "foo" defined in namespace "A\my" +my\foo(); // åå空é "A\my" ã§å®ç¾©ããã¦ãã颿° "foo" ãã³ã¼ã«ãã¾ã -F(); // first tries to call "F" defined in namespace "A" - // then calls global function "F" +F(); // ã¾ãåå空é "A" ã§å®ç¾©ããã¦ãã "F" ã®ã³ã¼ã«ã試ã¿ã + // 次ã«ã°ãã¼ãã«é¢æ° "F" ãã³ã¼ã«ãã¾ã -// class references +// ã¯ã©ã¹ã®åç § -new B(); // creates object of class "B" defined in namespace "A" - // if not found, it tries to autoload class "A\B" +new B(); // åå空é "A" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "B" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "A\B" ã® autoload ã試ã¿ã¾ã -new D(); // using import rules, creates object of class "D" defined in namespace "B" - // if not found, it tries to autoload class "B\D" +new D(); // ã¤ã³ãã¼ãã«ã¼ã«ã使ç¨ããåå空é "B" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "D" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "B\D" ã® autoload ã試ã¿ã¾ã -new F(); // using import rules, creates object of class "E" defined in namespace "C" - // if not found, it tries to autoload class "C\E" +new F(); // ã¤ã³ãã¼ãã«ã¼ã«ã使ç¨ããåå空é "C" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "E" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "C\E" ã® autoload ã試ã¿ã¾ã -new \B(); // creates object of class "B" defined in global scope - // if not found, it tries to autoload class "B" +new \B(); // ã°ãã¼ãã«ã¹ã³ã¼ãã§å®ç¾©ããã¦ããã¯ã©ã¹ "B" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "B" ã® autoload ã試ã¿ã¾ã -new \D(); // creates object of class "D" defined in global scope - // if not found, it tries to autoload class "D" +new \D(); // ã°ãã¼ãã«ã¹ã³ã¼ãã§å®ç¾©ããã¦ããã¯ã©ã¹ "D" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "D" ã® autoload ã試ã¿ã¾ã -new \F(); // creates object of class "F" defined in global scope - // if not found, it tries to autoload class "F" +new \F(); // ã°ãã¼ãã«ã¹ã³ã¼ãã§å®ç¾©ããã¦ããã¯ã©ã¹ "F" ã®ãªãã¸ã§ã¯ãã使ãã¾ã + // è¦ã¤ãããªãå ´åã¯ãã¯ã©ã¹ "F" ã® autoload ã試ã¿ã¾ã -// static methods/namespace functions from another namespace +// å¥ã®åå空éãã使ç¨ããéçã¡ã½ãã/颿° -B\foo(); // calls function "foo" from namespace "A\B" +B\foo(); // åå空é "A\B" ã®é¢æ° "foo" ãã³ã¼ã«ãã¾ã -B::foo(); // calls method "foo" of class "B" defined in namespace "A" - // if class "A\B" not found, it tries to autoload class "A\B" +B::foo(); // åå空é "A" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "B" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "A\B" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "A\B" ã® autoload ã試ã¿ã¾ã -D::foo(); // using import rules, calls method "foo" of class "D" defined in namespace "B" - // if class "B\D" not found, it tries to autoload class "B\D" +D::foo(); // ã¤ã³ãã¼ãã«ã¼ã«ã使ç¨ããåå空é "B" ã§å®ç¾©ããã¦ããã¯ã©ã¹ "D" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "B\D" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "B\D" ã® autoload ã試ã¿ã¾ã -\B\foo(); // calls function "foo" from namespace "B" +\B\foo(); // åå空é "B" ã®é¢æ° "foo" ãã³ã¼ã«ãã¾ã -\B::foo(); // calls method "foo" of class "B" from global scope - // if class "B" not found, it tries to autoload class "B" +\B::foo(); // ã°ãã¼ãã«ã¹ã³ã¼ãã®ã¯ã©ã¹ "B" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "B" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "B" ã® autoload ã試ã¿ã¾ã -// static methods/namespace functions of current namespace +// ç¾å¨ã®åå空éãã使ç¨ããéçã¡ã½ãã/颿° -A\B::foo(); // calls method "foo" of class "B" from namespace "A\A" - // if class "A\A\B" not found, it tries to autoload class "A\A\B" +A\B::foo(); // åå空é "A\A" ã®ã¯ã©ã¹ "B" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "A\A\B" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "A\A\B" ã® autoload ã試ã¿ã¾ã -\A\B::foo(); // calls method "foo" of class "B" from namespace "A\B" - // if class "A\B" not found, it tries to autoload class "A\B" +\A\B::foo(); // åå空é "A\B" ã®ã¯ã©ã¹ "B" ã®ã¡ã½ãã "foo" ãã³ã¼ã«ãã¾ã + // ã¯ã©ã¹ "A\B" ãè¦ã¤ãããªãå ´åã¯ã¯ã©ã¹ "A\B" ã® autoload ã試ã¿ã¾ã ?> ]]> </programlisting>