cvs: phpdoc /en/functions classobj.xml info.xml var.xml /ja language-defs.ent /ja/chapters install.xml /ja/functions array.xml classobj.xml
filesystem.xml funchand.xml info.xml oci8.xml pdf.xml var.xml zlib.xml /ja/pear about.xml pear.xml standards.xml
| From: | Rui Hirokawa | Date: | Fri, 09 Mar 2001 15:33:05 +0000 |
| Subject: | cvs: phpdoc /en/functions classobj.xml info.xml var.xml /ja language-defs.ent /ja/chapters install.xml /ja/functions array.xml classobj.xml filesystem.xml funchand.xml info.xml oci8.xml pdf.xml var.xml zlib.xml /ja/pear about.xml pear.xml standards.xml |
||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969334621@lists.php.net to get a copy of this message | ||
hirokawa Fri Mar 9 07:33:05 2001 EDT
Added files:
/phpdoc/ja/pear about.xml pear.xml standards.xml
Modified files:
/phpdoc/en/functions classobj.xml info.xml var.xml
/phpdoc/ja language-defs.ent
/phpdoc/ja/chapters install.xml
/phpdoc/ja/functions array.xml classobj.xml filesystem.xml
funchand.xml info.xml oci8.xml pdf.xml var.xml
zlib.xml
Log:
added pear/* , fixed typos, added some functions.
Index: phpdoc/en/functions/classobj.xml diff -u phpdoc/en/functions/classobj.xml:1.13 phpdoc/en/functions/classobj.xml:1.14 --- phpdoc/en/functions/classobj.xml:1.13 Wed Mar 7 15:15:13 2001 +++ phpdoc/en/functions/classobj.xml Fri Mar 9 07:33:03 2001 @@ -270,7 +270,7 @@ </informalexample> </para> <simpara> - See also <function>call_user_func_array</function>. + See also <function>call_user_func_array</function>, <function>call_user_func</function>, <function>call_user_method_array</function>. </simpara> Index: phpdoc/en/functions/info.xml diff -u phpdoc/en/functions/info.xml:1.39 phpdoc/en/functions/info.xml:1.40 --- phpdoc/en/functions/info.xml:1.39 Wed Mar 7 03:24:23 2001 +++ phpdoc/en/functions/info.xml Fri Mar 9 07:33:03 2001 @@ -1230,7 +1230,7 @@ <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>zendversion</function></funcdef> + <funcdef>string <function>zend_version</function></funcdef> <paramdef>void<parameter></parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1238,7 +1238,7 @@ Returns a string containing the version of the currently running PHP parser. <example> - <title>zendversion() example</title> + <title><function>zend_version</function> example</title> <programlisting role="php"> // prints e.g. 'Zend engine version: 1.0.4' echo "Zend engine version: ".zend_version(); Index: phpdoc/en/functions/var.xml diff -u phpdoc/en/functions/var.xml:1.35 phpdoc/en/functions/var.xml:1.36 --- phpdoc/en/functions/var.xml:1.35 Wed Mar 7 15:15:13 2001 +++ phpdoc/en/functions/var.xml Fri Mar 9 07:33:03 2001 @@ -146,7 +146,7 @@ <refnamediv> <refname>get_defined_vars</refname> <refpurpose> - Returns an array of all defined functions + Returns an array of all defined variables </refpurpose> </refnamediv> <refsect1> Index: phpdoc/ja/language-defs.ent diff -u phpdoc/ja/language-defs.ent:1.3 phpdoc/ja/language-defs.ent:1.4 --- phpdoc/ja/language-defs.ent:1.3 Sat Dec 16 19:37:13 2000 +++ phpdoc/ja/language-defs.ent Fri Mar 9 07:33:03 2001 @@ -5,5 +5,6 @@ <!ENTITY Features "æ©è½"> <!ENTITY FunctionReference "颿°ãªãã¡ã¬ã³ã¹"> <!ENTITY Appendixes "ä»é²"> +<!ENTITY PEAR "PEAR: the PHP Extension and Application Repository"> <!ENTITY available "available in"> Index: phpdoc/ja/chapters/install.xml diff -u phpdoc/ja/chapters/install.xml:1.26 phpdoc/ja/chapters/install.xml:1.27 --- phpdoc/ja/chapters/install.xml:1.26 Thu Mar 1 07:24:44 2001 +++ phpdoc/ja/chapters/install.xml Fri Mar 9 07:33:03 2001 @@ -4147,7 +4147,7 @@ . . . - .#注æ ãã®æ¬¡ã®è¡ã¯å ¨ã¦ã®'ObjectType'ã®å¾ã§ã'AddLog'è¡ã®åã¨ããå¿ è¦ãããã¾ã + .// 注æ ãã®æ¬¡ã®è¡ã¯å ¨ã¦ã®'ObjectType'ã®å¾ã§ã'AddLog'è¡ã®åã¨ããå¿ è¦ãããã¾ã Service fn="php4_execute" type="magnus-internal/x-httpd-php" . . @@ -4359,6 +4359,11 @@ æ£ããããã¨ããªãã§ãããããã°ã®ã¬ãã¼ãã¯ã<ulink url="&url.php.bugs;" >&url.php.bugs;</ulink>ã«ãããã°è¿½è·¡ã·ã¹ã ã ã使ç¨ãã¦ãè¡ããã¨ãã§ãã¾ãã + </simpara> + <simpara> + ãã°ã¬ãã¼ããæç¨¿ããåã« <ulink + url="&url.php.bugdosdonts;">Bugs-Dos-And-Donts</ulink> ãåç §ä¸ + ãã! </simpara> </sect2> Index: phpdoc/ja/functions/array.xml diff -u phpdoc/ja/functions/array.xml:1.20 phpdoc/ja/functions/array.xml:1.21 --- phpdoc/ja/functions/array.xml:1.20 Tue Feb 20 07:13:13 2001 +++ phpdoc/ja/functions/array.xml Fri Mar 9 07:33:03 2001 @@ -969,6 +969,42 @@ </refsect1> </refentry> + <refentry id="function.array-sum"> + <refnamediv> + <refname>array_sum</refname> + <refpurpose> + é åã®ä¸ã®å¤ã®åè¨ãè¨ç®ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>array_sum</function></funcdef> + <paramdef>array <parameter>arr</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>array_sum</function> ã¯ãé åã®ä¸ã®å¤ã®åè¨ãæ´æ°ã¾ã㯠+ floatã¨ãã¦è¿ãã¾ãã + </para> + <para> + <example> + <title><function>array_sum</function> ã®ä¾</title> + <programlisting role="php"> +$a = array(2,4,6,8); +echo "sum(a) = ".array_sum($a)."\n"; +// åºå: sum(a) = 20 + +$b = array("a"=>1.2,"b"=>2.3,"c"=>3.4); +echo "sum(b) = ".array_sum($b)."\n"; +// åºå: sum(b) = 6.9 + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.array-unique"> <refnamediv> <refname>array_unique</refname> Index: phpdoc/ja/functions/classobj.xml diff -u phpdoc/ja/functions/classobj.xml:1.8 phpdoc/ja/functions/classobj.xml:1.9 --- phpdoc/ja/functions/classobj.xml:1.8 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/classobj.xml Fri Mar 9 07:33:03 2001 @@ -161,6 +161,50 @@ </sect1> </partintro> + <refentry id="function.call-user-method-array"> + <refnamediv> + <refname>call_user_method_array</refname> + <refpurpose> + ãã©ã¡ã¼ã¿ã®é åãæå®ãã¦ã¦ã¼ã¶ã¡ã½ãããã³ã¼ã«ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed + <function>call_user_method_array</function> + </funcdef> + <paramdef>string + <parameter>method_name</parameter> + </paramdef> + <paramdef>object + <parameter>obj</parameter> + </paramdef> + <paramdef>array + <parameter><optional>paramarr</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã©ã¡ã¼ã¿ <parameter>paramarr</parameter> ã使ç¨ãã¦ã¦ã¼ã¶å®ç¾©ãª + ãã¸ã§ã¯ã <parameter>obj</parameter>ãã + <parameter>method_name</parameter>ã§åç §ãããã¡ã½ãããã³ã¼ã«ã + ã¾ãã + </para> + <para> + <function>call_user_func_array</function>, + <function>call_user_func</function>, + <function>call_user_method</function>ãåç §ä¸ããã + </para> + <note> + <para> + ãã®é¢æ°ã¯ãPHP 4.0.4pl1ã®ãªãªã¼ã¹å¾ã«CVSã³ã¼ãã«è¿½å ããã¾ããã + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.call-user-method"> <refnamediv> <refname>call_user_method</refname> @@ -230,7 +274,9 @@ </informalexample> </para> <simpara> - <function>call_user_func</function>ãåç §ä¸ããã + <function>call_user_func_array</function>, + <function>call_user_func</function>, + <function>call_user_method_array</function> ãåç §ä¸ããã </simpara> </refsect1> </refentry> Index: phpdoc/ja/functions/filesystem.xml diff -u phpdoc/ja/functions/filesystem.xml:1.26 phpdoc/ja/functions/filesystem.xml:1.27 --- phpdoc/ja/functions/filesystem.xml:1.26 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/filesystem.xml Fri Mar 9 07:33:03 2001 @@ -1146,7 +1146,7 @@ </itemizedlist> <parameter>mode</parameter> ã¯æå'b'ãæå®ãããã¨ãã§ãã¾ãã ããã¯ãã¤ããªã¨ããã¹ãã®ãã¡ã¤ã«å½¢å¼ãç°ãªãã·ã¹ãã ã§ã®ã¿æå¹ã§ãã - (ã¤ã¾ããUNIXã§ã¯ä¸è¦ã§ãã)å¿ è¦ããªãå ´åãç¡è¦ããã¾ãã + (Windowsã®å ´åã§ããUNIXã§ã¯ä¸è¦ã§ãã)ä¸è¦ã®å ´åãç¡è¦ããã¾ãã </para> <para> ãªãã·ã§ã³ã®2çªç®ã®å¼æ°ã使ç¨ãã¦ãããã«"1"ãè¨å®ãã @@ -1291,6 +1291,23 @@ </programlisting> </informalexample> </para> + <note> + <para> + ãã¤ããªã¨ããã¹ããã¡ã¤ã«ã®å½¢å¼ãç°ãªãã·ã¹ãã (ããªãã¡ + Windows)ã§ã¯ã<function>fopen</function>ã® mode ãã©ã¡ã¼ã¿ã«'b' + ãæå®ãã¦ãã¡ã¤ã«ããªã¼ãã³ããå¿ è¦ãããã¾ãã + </para> + </note> + <para> + <informalexample> + <programlisting role="php"> +$filename = "c:\\files\\somepic.gif"; +$fd = fopen ($filename, "rb"); +$contents = fread ($fd, filesize ($filename)); +fclose ($fd); + </programlisting> + </informalexample> + </para> <simpara> <function>fwrite</function>, <function>fopen</function>, <function>fsockopen</function>, <function>popen</function>, @@ -1804,6 +1821,25 @@ </para> <para> <function>is_readable</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.is-writeable"> + <refnamediv> + <refname>is_writeable</refname> + <refpurpose>ãã¡ã¤ã«ãæ¸ãè¾¼ã¿å¯è½ãã©ãã確èªãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>is_writeable</function></funcdef> + <paramdef>string <parameter>filename</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ã<function>is_writable</function>ã®ã¨ã¤ãªã¢ã¹ã§ãã </para> </refsect1> </refentry> Index: phpdoc/ja/functions/funchand.xml diff -u phpdoc/ja/functions/funchand.xml:1.5 phpdoc/ja/functions/funchand.xml:1.6 --- phpdoc/ja/functions/funchand.xml:1.5 Thu Mar 1 07:24:45 2001 +++ phpdoc/ja/functions/funchand.xml Fri Mar 9 07:33:03 2001 @@ -8,6 +8,65 @@ </para> </partintro> + <refentry id="function.call-user-func-array"> + <refnamediv> + <refname>call_user_func_array</refname> + <refpurpose> + ãã©ã¡ã¼ã¿ã®é åãæå®ãã¦ã¦ã¼ã¶é¢æ°ãã³ã¼ã«ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed + <function>call_user_func_array</function> + </funcdef> + <paramdef>string + <parameter>function_name</parameter> + </paramdef> + <paramdef>array + <parameter><optional>paramarr</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>paramarr</parameter> ã«ãã©ã¡ã¼ã¿ãæå®ãã¦ã + <parameter>function_name</parameter>ã§æå®ããã¦ã¼ã¶å®ç¾©é¢æ°ãã³ã¼ + ã«ãã¾ããä¾ãã°æ¬¡ã®ããã«ãªãã¾ãã + <informalexample> + <programlisting role="php"> +function debug($var, $val) + echo "***DEBUGGING\nVARIABLE: $var\nVALUE:"; + if (is_array($val) || is_object($val) || is_resource($val)) + print_r($val); + else + echo "\n$val\n"; + echo "***\n"; +} + +$c = mysql_connect(); +$host = $HTTP_SERVER_VARS["SERVER_NAME"]; + +call_user_func_array ('debug', array("host", $host)); +call_user_func_array ('debug', array("c", $c)); +call_user_func_array ('debug', array("HTTP_POST_VARS", $HTTP_POST_VARS)); + </programlisting> + </informalexample> + </para> + <para> + <function>call_user_func</function>, + <function>call_user_method</function>, + <function>call_user_method_array</function>ãåç §ä¸ããã + </para> + <note> + <para> + ãã®é¢æ°ã¯ãPHP 4.0.4pl1ã®ãªãªã¼ã¹å¾ã«CVSã³ã¼ãã«è¿½å ããã¾ããã + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.call-user-func"> <refnamediv> <refname>call_user_func</refname> @@ -50,6 +109,11 @@ </programlisting> </informalexample> </para> + <para> + <function>call_user_func_array</function>, + <function>call_user_method</function>, + <function>call_user_method_array</function>ãåç §ä¸ããã + </para> </refsect1> </refentry> @@ -385,6 +449,74 @@ </refsect1> </refentry> + <refentry id="function.get-defined-functions"> + <refnamediv> + <refname>get_defined_functions</refname> + <refpurpose> + å®ç¾©æ¸ã¿ã®å ¨ã¦ã®é¢æ°ãé åã§è¿ã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>get_defined_functions</function></funcdef> + <paramdef>void <parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãçµè¾¼(å é¨)颿°ããã³ã¦ã¼ã¶å®ç¾©é¢æ°ãå ±ã«å«ãå®ç¾©æ¸ã¿ + ã®å ¨ã¦ã®é¢æ°ã®ãªã¹ããæãã夿¬¡å é åãè¿ãã¾ããå é¨é¢æ°ã¯ã + <varname>$arr["internal"]</varname>ãã¦ã¼ã¶å®ç¾©é¢æ°ã¯ + <varname>$arr["user"]</varname> ã«ããã¢ã¯ã»ã¹å¯è½ã¨ãªãã¾ãã(以 + ä¸ã®ä¾ãåç §) + <informalexample> + <programlisting role="php"> +function myrow($id, $data) { + return "<tr><th>$id</th><td>$data</td></tr>\n"; +} + +$arr = get_defined_functions(); + +print_r($arr); + </programlisting> + </informalexample> + </para> + <para> + ãã®ä¾ã®åºåã¯ã以ä¸ã®ããã«ãªãã¾ãã + <informalexample> + <programlisting> +Array +( + [internal] => Array + ( + [0] => zend_version + [1] => func_num_args + [2] => func_get_arg + [3] => func_get_args + [4] => strlen + [5] => strcmp + [6] => strncmp + ... + [750] => bcscale + [751] => bccomp + ) + + [user] => Array + ( + [0] => myrow + ) + +) + </programlisting> + </informalexample> + </para> + <para> + <function>get_defined_vars</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.register-shutdown-function"> <refnamediv> <refname>register_shutdown_function</refname> Index: phpdoc/ja/functions/info.xml diff -u phpdoc/ja/functions/info.xml:1.20 phpdoc/ja/functions/info.xml:1.21 --- phpdoc/ja/functions/info.xml:1.20 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/info.xml Fri Mar 9 07:33:03 2001 @@ -786,7 +786,8 @@ </para> <para> <function>phpinfo</function>,<function>phpcredits</function>, - <function>php_logo_guid</function>ãåç §ä¸ããã + <function>php_logo_guid</function>,<function>zend_version</function> + ãåç §ä¸ããã </para> </refsect1> </refentry> @@ -1199,6 +1200,38 @@ <function>require_once</function>ã <function>include_once</function>ã <function>get_required_files</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.zend-version"> + <refnamediv> + <refname>zend_version</refname> + <refpurpose>ã«ã¬ã³ãã®Zendã¨ã³ã¸ã³ã®ãã¼ã¸ã§ã³ãåå¾ãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>zend_version</function></funcdef> + <paramdef>void<parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + PHPãã¼ãµãç¾å¨å®è¡ä¸ã®Zendã®ãã¼ã¸ã§ã³ãæååã¨ãã¦è¿ãã¾ãã + <example> + <title><function>zend_version</function>ã®ä¾</title> + <programlisting role="php"> +// ä¾ãã°ã'Zend engine version: 1.0.4' ãåºå +echo "Zend engine version: ".zend_version(); + </programlisting> + </example> + </para> + <para> + <function>phpinfo</function>, + <function>phpcredits</function>, + <function>php_logo_guid</function> + <function>phpversion</function>ãåç §ä¸ããã </para> </refsect1> </refentry> Index: phpdoc/ja/functions/oci8.xml diff -u phpdoc/ja/functions/oci8.xml:1.11 phpdoc/ja/functions/oci8.xml:1.12 --- phpdoc/ja/functions/oci8.xml:1.11 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/oci8.xml Fri Mar 9 07:33:03 2001 @@ -56,6 +56,41 @@ Webãµã¼ãã¼ã®ã¦ã¼ã¶ç¨ã«ç°å¢å¤æ°ãè¨å®ããå¾ãWebãµã¼ãã¼ã®ã¦ã¼ã¶ (nobody, www)ãã°ã«ã¼ãoracleã«è¿½å ãã¦ä¸ããã </para> + <note> + <title>Webãµã¼ããèµ·åããªãããèµ·åæã«ã¯ã©ãã·ã¥ããå ´å</title> + <para> + Apacheãpthreadã©ã¤ãã©ãªã«ãªã³ã¯ããã¦ãããã©ããæ¬¡ã®ããã«ç¢ºèª + ãã¦ä¸ããã + </para> + <para> + <informalexample> + <programlisting> +> ldd /www/apache/bin/httpd + libpthread.so.0 => /lib/libpthread.so.0 (0x4001c000) + libm.so.6 => /lib/libm.so.6 (0x4002f000) + libcrypt.so.1 => /lib/libcrypt.so.1 (0x4004c000) + libdl.so.2 => /lib/libdl.so.2 (0x4007a000) + libc.so.6 => /lib/libc.so.6 (0x4007e000) + /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) + </programlisting> + </informalexample> + </para> + <para> + libpthread ããã®ä¸è¦§ã«ãªãå ´åãApacheãåã¤ã³ã¹ãã¼ã«ããå¿ è¦ã + ããã¾ãã + </para> + <para> + <informalexample> + <programlisting> +> cd /usr/src/apache_1.3.xx +> make clean +> LIBS=-lpthread ./config.status +> make +> make install + </programlisting> + </informalexample> + </para> + </note> <para> <example> <title>OCIã«é¢ãããã³ã</title> Index: phpdoc/ja/functions/pdf.xml diff -u phpdoc/ja/functions/pdf.xml:1.18 phpdoc/ja/functions/pdf.xml:1.19 --- phpdoc/ja/functions/pdf.xml:1.18 Sat Mar 3 16:53:36 2001 +++ phpdoc/ja/functions/pdf.xml Fri Mar 9 07:33:03 2001 @@ -434,7 +434,7 @@ PDF_end_page($pdf); - # å¤åãè¦ãããã«å¾ 㤠+ /* å¤åãè¦ãããã«å¾ 㤠*/ sleep(1); } @@ -1128,16 +1128,16 @@ </refsect1> </refentry> - <refentry id="function.pdf-endpattern"> + <refentry id="function.pdf-end-pattern"> <refnamediv> - <refname>PDF_endpattern</refname> + <refname>PDF_end_pattern</refname> <refpurpose>ãã¿ã¼ã³ãçµäºãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>void <function>PDF_endpattern</function></funcdef> + <funcdef>void <function>PDF_end_pattern</function></funcdef> <paramdef>int <parameter>pdf object</parameter></paramdef> </funcprototype> </funcsynopsis> Index: phpdoc/ja/functions/var.xml diff -u phpdoc/ja/functions/var.xml:1.22 phpdoc/ja/functions/var.xml:1.23 --- phpdoc/ja/functions/var.xml:1.22 Thu Jan 4 22:29:05 2001 +++ phpdoc/ja/functions/var.xml Fri Mar 9 07:33:04 2001 @@ -60,7 +60,7 @@ <informalexample> <programlisting role="php"> $var = 0; -if ( empty($var) ) { #trueã¨è©ä¾¡ãããå ´å +if ( empty($var) ) { // trueã¨è©ä¾¡ãããå ´å print '$var is either 0 or not at all set'; } if ( !isset($var) ) { // falseã¨è©ä¾¡ãããå ´å @@ -140,6 +140,89 @@ </refsect1> </refentry> + <refentry id="function.get-defined-vars"> + <refnamediv> + <refname>get_defined_vars</refname> + <refpurpose> + å ¨ã¦ã®å®ç¾©æ¸ã®å¤æ°ãé åã§è¿ã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>get_defined_vars</function></funcdef> + <paramdef>void <parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãç°å¢å¤æ°ããµã¼ã夿°ãã¦ã¼ã¶ãå®ç¾©ãã夿°ãå«ãå ¨ã¦ + ã®å®ç¾©æ¸ã®å¤æ°ã®ãªã¹ããæãã夿¬¡å ã®é åãè¿ãã¾ãã + <informalexample> + <programlisting role="php"> +$b = array(1,1,2,3,5,8); + +$arr = get_defined_vars(); + +// $b ãåºå +print_r($arr["b"]); + +// PHPã¤ã³ã¿ããªã¿ã®ãã¹ãåºå (CGIã¨ãã¦ä½¿ç¨ãããå ´å) +// ä¾ãã°ã/usr/local/bin/php +echo $arr["_"]; + +// ã³ãã³ãã©ã¤ã³ãã©ã¡ã¼ã¿ãããå ´åã«åºå +print_r($arr["argv"]); + +// ãµã¼ã夿°ãå ¨ã¦è¡¨ç¤º +print_r($arr["HTTP_SERVER_VARS"]); + +// 夿°ã®é åã§å©ç¨å¯è½ãªãã¼ãå ¨ã¦åºå +print_r(array_keys(get_defined_vars())); + </programlisting> + </informalexample> + </para> + <para> + <function>get_defined_functions</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.get-resource-type"> + <refnamediv> + <refname>get_resource_type</refname> + <refpurpose>ãªã½ã¼ã¹åãè¿ã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>get_resource_type</function></funcdef> + <paramdef>resource <parameter>$handle</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãæå®ãããªã½ã¼ã¹ã®åã表ãæååãè¿ãã¾ãããã©ã¡ã¼ + ã¿ããæå¹ãªãªã½ã¼ã¹ã§ãªãå ´åã¯ã¨ã©ã¼ã¨ãªãã¾ãã + <informalexample> + <programlisting role="php"> +$c = mysql_connect(); +echo get_resource_type($c)."\n"; +// mysql link ãåºå + +$fp = fopen("foo","w"); +echo get_resource_type($fp)."\n"; +// file ãåºå + +$doc = new_xmldoc("1.0"); +echo get_resource_type($doc->doc)."\n"; +// domxml document ãåºå + </programlisting> + </informalexample> + </para> + </refsect1> + </refentry> + <refentry id="function.intval"> <refnamediv> <refname>intval</refname> @@ -388,6 +471,40 @@ </refsect1> </refentry> + <refentry id="function.is-null"> + <refnamediv> + <refname>is_null</refname> + <refpurpose> + 夿°ããã«ãã©ãã調ã¹ã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>is_null</function></funcdef> + <paramdef>mixed <parameter>var</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>var</parameter> ããã«ã®å ´åã«trueããã®ä»ã«falseãè¿ + ãã¾ãã + </para> + <para> + <function>is_bool</function>, + <function>is_double</function>, + <function>is_numeric</function>, + <function>is_float</function>, + <function>is_int</function>, + <function>is_real</function>, + <function>is_string</function>, + <function>is_object</function>, + <function>is_array</function>, + <function>is_integer</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.is-numeric"> <refnamediv> <refname>is_numeric</refname> @@ -509,6 +626,82 @@ </refsect1> </refentry> + <refentry id="function.is-scalar"> + <refnamediv> + <refname>is_scalar</refname> + <refpurpose> + 夿°ãã¹ã«ã©ã¼ãã©ããã調ã¹ã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool + <function>is_scalar</function> + </funcdef> + <paramdef>mixed + <parameter>var</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>is_scalar</function> returns true if the variable + given by the <parameter>var</parameter> parameter is a scalar, + otherwise it returns false. + </para> + <para> + Scalar variables are those containing an integer, float, string + or boolean. For example: + <informalexample> + <programlisting role="php"> +function show_var($var) { + if (is_scalar($var)) + echo $var; + else + var_dump($var); +} + +$pi = 3.1416; +$proteins = array("hemoglobin", "cytochrome c oxidase", "ferredoxin"); + +show_var($pi); +// prints: 3.1416 + +show_var($proteins) +// prints: +// array(3) { +// [0]=> +// string(10) "hemoglobin" +// [1]=> +// string(20) "cytochrome c oxidase" +// [2]=> +// string(10) "ferredoxin" +// } + </programlisting> + </informalexample> + </para> + <note> + <para> + ãã®é¢æ°ã¯ãPHP 4.0.4pl1 ã®ãªãªã¼ã¹ã³ã¼ãå¾ã«CVSã³ã¼ãã«è¿½å ãã + ã¾ããã4.0.4pl1 + </para> + </note> + <para> + <function>is_bool</function>, + <function>is_double</function>, + <function>is_numeric</function>, + <function>is_float</function>, + <function>is_int</function>, + <function>is_real</function>, + <function>is_string</function>, + <function>is_object</function>, + <function>is_array</function>, + <function>is_integer</function> ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.is-string"> <refnamediv> <refname>is_string</refname> Index: phpdoc/ja/functions/zlib.xml diff -u phpdoc/ja/functions/zlib.xml:1.9 phpdoc/ja/functions/zlib.xml:1.10 --- phpdoc/ja/functions/zlib.xml:1.9 Thu Mar 1 07:24:45 2001 +++ phpdoc/ja/functions/zlib.xml Fri Mar 9 07:33:04 2001 @@ -626,10 +626,10 @@ </funcprototype> </funcsynopsis> <para> - ãã®é¢æ°ã¯ãå ¥å<parameter>data</parameter>ãdeflateã¢ã«ã´ãªãºã - ã«ããgzipå§ç¸®ããããã®ãè¿ããã¨ã©ã¼ã®å ´åã«falseãè¿ãã¾ãã - ãªãã·ã§ã³ã®ãã©ã¡ã¼ã¿<parameter>level</parameter>ã«ã¯ã - 0ã§å§ç¸®ç¡ãã9ã§æå¤§éã®å§ç¸®ãæå®ã§ãã¾ãã + ãã®é¢æ°ã¯ãå ¥å<parameter>data</parameter>ãZLIBãã¼ã¿ãã©ã¼ãã + ããæãã¦compresså§ç¸®ããããã®ãè¿ããã¨ã©ã¼ã®å ´åã«falseãè¿ã + ã¾ãããªãã·ã§ã³ã®ãã©ã¡ã¼ã¿<parameter>level</parameter>ã«ã¯ã0ã§ + å§ç¸®ç¡ãã9ã§æå¤§éã®å§ç¸®ãæå®ã§ãã¾ãã </para> <note> <para> @@ -672,6 +672,130 @@ </para> <para> <function>gzcompress</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.gzdeflate"> + <refnamediv> + <refname>gzdeflate</refname> + <refpurpose>æååã deflate å§ç¸®ãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>gzdeflate</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>int + <parameter><optional>level</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãå ¥å <parameter>data</parameter> ãDEFLATEãã¼ã¿ãã©ã¼ + ããããç¨ãã¦å§ç¸®ãããã®ãè¿ãã¾ããã¨ã©ã¼ã®å ´åã«ã¯falseãè¿ã + ã¾ãããªãã·ã§ã³ã®ãã©ã¡ã¼ã¿<parameter>level</parameter>ã«ã¯ãå§ + 縮ããªãå ´åã«0ãæå¤§éã®å§ç¸®ãããå ´åã«9ãæå®å¯è½ã§ãã + </para> + <para> + DEFLATEå§ç¸®ã¢ã«ã´ãªãºã ã®è©³ç´°ã«ã¤ãã¦ã¯ãããã¥ã¡ã³ã + "<ulink url="&url.rfc1951;">DEFLATE Compressed Data Format + Specification version 1.3</ulink>" (RFC 1951)ãåç §ä¸ããã + </para> + <para> + <function>gzinflate</function>, + <function>gzcompress</function>, + <function>gzuncompress</function>, + <function>gzencode</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.gzinflate"> + <refnamediv> + <refname>gzinflate</refname> + <refpurpose>deflateå§ç¸®ãããæååãè§£åãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>gzinflate</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>int + <parameter><optional>length</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ã<function>gzdeflate</function>ã«ããå§ç¸®ããã + <parameter>data</parameter> ã弿°ã¨ããå§ç¸®åã®å ã®ãã¼ã¿ãè¿ã + ã¾ããã¨ã©ã¼ã®å ´åã«ã¯falseãè¿ãã¾ãããã®é¢æ°ã¯ãè§£åããããã¼ + ã¿ãå§ç¸®ãããå ¥å <parameter>data</parameter> ã®é·ãã®256åãã¾ + ãã¯ãªãã·ã§ã³ã®ãã©ã¡ã¼ã¿<parameter>length</parameter>以ä¸ã®é·ã + ã§ããå ´åã«ã¨ã©ã¼ãè¿ãã¾ãã + </para> + <para> + <function>gzcompress</function>. + <function>gzuncompress</function>, + <function>gzdeflate</function>, + <function>gzencode</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.gzencode"> + <refnamediv> + <refname>gzencode</refname> + <refpurpose>gzip å§ç¸®ãããæååã使</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>gzencode</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>int + <parameter><optional>level</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãå ¥å <parameter>data</parameter>ã + <command>gzip</command> ããã°ã©ã ã®åºåã¨äºææ§ã®ããå½¢å¼ã§å§ç¸® + ãã¦è¿ãã¾ããã¨ã©ã¼ãçºçããå ´åã¯ãfalseãè¿ãã¾ãããªãã·ã§ã³ + ã®ãã©ã¡ã¼ã¿<parameter>level</parameter> ã«ã¯ãå§ç¸®ãããªãå ´åã« + 0ãæå¤§éã®å§ç¸®ãè¡ãå ´åã«9ãæå®å¯è½ã§ããæå®ãããªãå ´åã®ã + ãã©ã«ãå§ç¸®ã¬ãã«ã¯1ã«ãªãã¾ãã + </para> + <para> + è¿ããããã¼ã¿ã«ã¯ãæ¨æºçãª.gzãã¡ã¤ã«ã¨ããããã«é©å½ãªããã㨠+ ãã¼ã¿æ§é ãå«ã¾ãã¾ããä¾ã以ä¸ã«ç¤ºãã¾ãã + <example> + <title>gzipãã¡ã¤ã«ã使ãã</title> + <programlisting role="php"> +<?php +$data = implode("", "bigfile.txt"); +$gzdata = gzencode($data, 9); +$fp = fopen("bigfile.txt.gz", "w"); +fwrite($fp, $gzdata); +fclose($fp); +?> + </programlisting> + </example> + </para> + <para> + GZIPãã¡ã¤ã«ãã©ã¼ãããã«é¢ããè©³ç´°ãªæ å ±ã«ã¤ãã¦ã¯ã次ã®ãã㥠+ ã¡ã³ããåç §ä¸ããã + <ulink url="&url.rfc1952">GZIP file format specification + version 4.3</ulink> (RFC 1952) + </para> + <para> + <function>gzcompress</function>. + <function>gzuncompress</function>, + <function>gzdeflate</function>, + <function>gzinflate</function>ãåç §ä¸ããã </para> </refsect1> </refentry> Index: phpdoc/ja/pear/about.xml +++ phpdoc/ja/pear/about.xml <chapter id="pear.about"> <title>PEARã«ã¤ãã¦</title> <simpara> PEAR ã¯ã1999/11/21 ã«çã¾ãã <ulink url="&url.malinimg;">Malin Bakken</ulink>ã«æ§ãããã¦ãã¾ãã(æåã®PEARã®ã³ã¼ãã¯ã彼女ãçã¾ ããã¡ããã©äºæéå¾ã«ãããã¾ããã) </simpara> <sect1 id="pear-whatis"> <title>PEARã¨ã¯?</title> <simpara> PEAR ã¯ãTeXã® CTAN ããã³ Perlã® CPANã«ãã³ããå¾ãPHPæ¡å¼µããã³ PHPã©ã¤ãã©ãªã®ã³ã¼ãç¨ã®ã³ã¼ãã¬ãã¸ããªã§ãã </simpara> <para> PEARã®ç®çã¯æ¬¡ã®ãããªãã®ã§ãã <itemizedlist> <listitem> <simpara> ã©ã¤ãã©ãªã³ã¼ãã®ä½è ã«ä»ã®éçºè ã¨ã³ã¼ããå ±æããããã®ç¢ºå® ãªææ®µãæä¾ãã </simpara> </listitem> <listitem> <simpara> PHPã³ãã¥ããã£ã«ã³ã¼ããå ±æããããã®ã¤ã³ãã©ãæä¾ãã </simpara> </listitem> <listitem> <simpara> éçºè ãç§»æ¤æ§ã®é«ãå使ç¨å¯è½ãªã³ã¼ããæ¸ããããããããã«æ¨ æºãå®ç¾©ãã </simpara> </listitem> <listitem> <simpara> ã³ã¼ãã®ç¶æç®¡çã¨é å¸ã®ããã®ãã¼ã«ãæä¾ãã </simpara> </listitem> </itemizedlist> </para> </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: --> Index: phpdoc/ja/pear/pear.xml +++ phpdoc/ja/pear/pear.xml <reference id="ref.pear"> <title>PEAR ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«</title> <titleabbrev>PEAR</titleabbrev> <partintro> <simpara> æ¬ç« ã¯ãPHPã«ä»å±ãã PEARã³ã³ãã¼ãã³ãã«é¢ãããªãã¡ã¬ã³ã¹ã§ãã ããã§ã¯ã<link linkend="language.oop">ãªãã¸ã§ã¯ãã¨ã¯ã©ã¹</link> ã«æ¢ã«æ £ãã¦ãããã¨ãåæã¨ãã¾ãã </simpara> </partintro> <refentry id="class.pear"> <refnamediv> <refname>PEAR</refname> <refpurpose>PEAR ãã¼ã¹ã¯ã©ã¹</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>class <replaceable>classname</replaceable> extends <classname>PEAR</classname> { ... }</synopsis> </refsynopsisdiv> <refsect1> <title>説æ</title> <simpara> PEARãã¼ã¹ã¯ã©ã¹ã¯ãå¤ãã®PEARã¯ã©ã¹ã§ä½¿ç¨ãããæ¨æºçãªæ©è½ãæ ä¾ãã¾ããé常ãPEARã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ãç´æ¥ä½æãããã¨ã¯ãã ã¾ããããã®ã¯ã©ã¹ã®ãµãã¯ã©ã¹åãã¦ä½¿ç¨ãã¦ä¸ããã </simpara> <para> ä¸»ãªæ©è½ã以ä¸ã«ç¤ºãã¾ãã <itemizedlist> <listitem> <simpara>ãªãã¸ã§ã¯ãçµäºå¦ç "ãã¹ãã©ã¯ã¿"</simpara> </listitem> <listitem> <simpara>ã¨ã©ã¼å¦ç</simpara> </listitem> </itemizedlist> </para> <refsect2> <title>PEAR "ãã¹ãã©ã¯ã¿"</title> <simpara> If you inherit <classname>PEAR</classname> in a class called <replaceable>ClassName</replaceable>, you can define a method in it called called _<replaceable>ClassName</replaceable> (the class name with an underscore prepended) that will be invoked when the request is over. This is not a destructor in the sense that you can "delete" an object and have the destructor called, but in the sense that PHP gives you a callback in the object when it is done executing. See <link linkend="example.pear.destructors">the example</link> below. </simpara> </refsect2> <refsect2> <title>PEARã®ã¨ã©ã¼å¦ç</title> <simpara> PEAR's base class also provides a way of passing around more complex errors than a true/false value or a numeric code. A PEAR error is an object that is either an instance of the class <classname>PEAR_Error</classname>, or some class inheriting <classname>PEAR_Error</classname>. </simpara> <simpara> One of the design criteria of PEAR's errors is that it should not force a particular type of output on the user, it should be possible to handle errors without any output at all if that is desireable. This makes it possible to handle errors gracefully, also when your output format is different from HTML (for example WML or some other XML format). </simpara> <simpara> The error object can be configured to do a number of things when it is created, such as printing an error message, printing the message and exiting, raising an error with PHP's <function>trigger_error</function> function, invoke a callback, or none of the above. This is typically specified in <classname>PEAR_Error</classname>'s constructor, but all of the parameters are optional, and you can set up defaults for errors generated from each object based on the <classname>PEAR</classname> class. See the <link linkend="example.pear.error1">PEAR error examples</link> for how to use it and the <classname>PEAR_Error</classname> reference for the full details. </simpara> </refsect2> </refsect1> <refsect1> <title>ä¾</title> <para> The example below shows how to use the PEAR's "poor man's kinda emulated destructors" to implement a simple class that holds the contents of a file, lets you append data to the object and flushes the data back to the file at the end of the request: <example id="example.pear.destructors"> <title>PEAR: emulated destructors</title> <programlisting role="php"> require_once "PEAR.php"; class FileContainer extends PEAR { var $file = ''; var $contents = ''; var $modified = 0; function FileContainer($file) { $this->PEAR(); // this calls the parent class constructor $fp = fopen($file, "r"); if (!is_resource($fp)) { return; } while (!empty($data = fread($fp, 2048))) { $this->contents .= $data; } fclose($fp); } function append($str) { $this->contents .= $str; $this->modified++; } // The "destructor" is named like the constructor // but with an underscore in front. function _FileContainer() { if ($this->modified) { $fp = fopen($this->file, "w"); if (!is_resource($fp)) { return; } fwrite($fp, $this->contents); fclose($fp); } } } $fileobj = new FileContainer("testfile"); $fileobj->append("this ends up at the end of the file\n"); // When the request is done and PHP shuts down, $fileobj's // "destructor" is called and updates the file on disk. </programlisting> </example> <note> <simpara> PEAR "destructors" use PHP's shutdown callbacks (<function>register_shutdown_function</function>), and you can't output anything from these when PHP is running in a web server. So anything printed in a "destructor" gets lost except when PHP is used in command-line mode. Bummer. </simpara> </note> </para> <simpara> The next examples illustrate different ways of using PEAR's error handling mechanism. </simpara> <para> <example id="example.pear.error1"> <title>PEAR error ã®ä¾ (1)</title> <programlisting role="php"> function mysockopen($host = "localhost", $port = 8090) { $fp = fsockopen($host, $port, $errno, $errstr); if (!is_resource($fp)) { return new PEAR_Error($errstr, $errno); } return $fp; } $sock = mysockopen(); if (PEAR::isError($sock)) { print "mysockopen error: ".$sock->getMessage()."<BR>\n" } </programlisting> </example> </para> <simpara> This example shows a wrapper to <function>fsockopen</function> that delivers the error code and message (if any) returned by fsockopen in a PEAR error object. Notice that <function>PEAR::isError</function> is used to detect whether a value is a PEAR error. </simpara> <simpara> PEAR_Error's mode of operation in this example is simply returning the error object and leaving the rest to the user (programmer). This is the default error mode. </simpara> <simpara> In the next example we're showing how to use default error modes: </simpara> <para> <example id="example.pear.error2"> <title>PEAR error example (2)</title> <programlisting role="php"> class TCP_Socket extends PEAR { var $sock; function TCP_Socket() { $this->PEAR(); } function connect($host, $port) { $sock = fsockopen($host, $port, $errno, $errstr); if (!is_resource($sock)) { return $this->raiseError($errstr, $errno); } } } $sock = new TCP_Socket; $sock->setErrorHandling(PEAR_ERROR_DIE); $sock->connect("localhost", 8090); print "still alive<BR>\n"; </programlisting> </example> </para> <simpara> Here, we set the default error mode to <constant>PEAR_ERROR_DIE</constant>, and since we don't specify any error mode in the raiseError call (that'd be the third parameter), raiseError uses the default error mode and exits if fsockopen fails. </simpara> </refsect1> </refentry> <refentry id="class.pear-error"> <refnamediv> <refname>PEAR_Error</refname> <refpurpose>PEARã¨ã©ã¼å¦çæ©è½ã®åºåºã¯ã©ã¹</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>$err = new <classname>PEAR_Error</classname>($msg);</synopsis> </refsynopsisdiv> <refsect1> <title>ã¨ã©ã¼ã¢ã¼ã</title> <para> An error object has a mode of operation that can be set with one of the following constants: <variablelist id="pear.error-modes"> <varlistentry id="constant.pear-error-return"> <term>PEAR_ERROR_RETURN</term> <listitem> <simpara> Just return the object, don't do anything special in PEAR_Error's constructor. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-print"> <term>PEAR_ERROR_PRINT</term> <listitem> <simpara> Print the error message in the constructor. The execution is not interrupted. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-trigger"> <term>PEAR_ERROR_TRIGGER</term> <listitem> <simpara> Use PHP's <function>trigger_error</function> function to raise an internal error in PHP. The execution is aborted if you have defined your own PHP error handler or if you set the error severity to E_USER_ERROR. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-die"> <term>PEAR_ERROR_DIE</term> <listitem> <simpara> Print the error message and exit. Execution is of course aborted. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-callback"> <term>PEAR_ERROR_CALLBACK</term> <listitem> <simpara> Use a callback function or method to handle errors. Execution is aborted. </simpara> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1> <title>ããããã£</title> <simpara></simpara> </refsect1> <refsect1> <title>ã¡ã½ãã</title> <funcsynopsis> <funcprototype> <funcdef><function>PEAR_Error::PEAR_Error</function></funcdef> <paramdef> <parameter><optional>message</optional></parameter> <parameter><optional>code</optional></parameter> <parameter><optional>mode</optional></parameter> <parameter><optional>options</optional></parameter> <parameter><optional>userinfo</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <refsect2> <title>説æ</title> <para> PEAR_Error constructor. Parameters: <variablelist> <varlistentry> <term>message</term> <listitem> <simpara> error message, defaults to "unknown error" </simpara> </listitem> </varlistentry> <varlistentry> <term>code</term> <listitem> <simpara> error code (optional) </simpara> </listitem> </varlistentry> <varlistentry> <term>mode</term> <listitem> <simpara> Mode of operation. See the <link linkend="pear.error-modes">error modes</link> section for details. </simpara> </listitem> </varlistentry> <varlistentry> <term>options</term> <listitem> <simpara> If the mode of can have any options specified, use this parameter. Currently the "trigger" and "callback" modes are the only using the options parameter. For trigger mode, this parameter is one of <constant>E_USER_NOTICE</constant>, <constant>E_USER_WARNING</constant> or <constant>E_USER_ERROR</constant>. For callback mode, this parameter should contain either the callback function name (string), or a two-element (object, string) array representing an object and a method name. </simpara> </listitem> </varlistentry> </variablelist> </para> </refsect2> </refsect1> </refentry> </reference> <!-- 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: --> Index: phpdoc/ja/pear/standards.xml +++ phpdoc/ja/pear/standards.xml <chapter id="pear.standards"> <title>PEAR ã³ã¼ãã£ã³ã°æ¨æº</title> <sect1 id="pear.standards.indenting"> <title>ã¤ã³ãã³ã</title> <para> Use an indent of 4 spaces, with no tabs. If you use Emacs to edit PEAR code, you should set indent-tabs-mode to nil. Here is an example mode hook that will set up Emacs according to these guidelines (you will need to ensure that it is called when you are editing php files): <programlisting role="elisp"> (defun php-mode-hook () (setq tab-width 4 c-basic-offset 4 c-hanging-comment-ender-p nil indent-tabs-mode nil)) </programlisting> </para> <para>Here are vim rules for the same thing: <programlisting role="vim"> set expandtab set shiftwidth=4 set tabstop=4 </programlisting> </para> </sect1> <sect1 id="pear.standards.control"> <title>å¶å¾¡æ§é </title> <para> These include if, for, while, switch, etc. Here is an example if statement, since it is the most complicated of them: <programlisting role="php"> if ((condition1) || (condition2)) { action1; } elseif ((condition3) && (condition4)) { action2; } else { defaultaction; } </programlisting> </para> <simpara> Control statements should have one space between the control keyword and opening parenthesis, to distinguish them from function calls. </simpara> <simpara> You are strongly encouraged to always use curly braces even in situations where they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added. </simpara> <para> For switch statements: <programlisting role="php"> switch (condition) { case 1: action1; break; case 2: action2; break; default: defaultaction; break; } </programlisting> </para> </sect1> <sect1 id="pear.standards.funcalls"> <title>颿°ã®ã³ã¼ã«</title> <para> Functions should be called with no spaces between the function name, the opening parenthesis, and the first parameter; spaces between commas and each parameter, and no space between the last parameter, the closing parenthesis, and the semicolon. Here's an example: <programlisting role="php"> $var = foo($bar, $baz, $quux); </programlisting> </para> <para> As displayed above, there should be one space on either side of an equals sign used to assign the return value of a function to a variable. In the case of a block of related assignments, more space may be inserted to promote readability: <programlisting role="php"> $short = foo($bar); $long_variable = foo($baz); </programlisting> </para> </sect1> <sect1 id="pear.standards.funcdef"> <title>颿°ã®å®ç¾©</title> <para> Function declaractions follow the "one true brace" convention: <programlisting role="php"> function fooFunction($arg1, $arg2 = '') { if (condition) { statement; } return $val; } </programlisting> </para> <para> Arguments with default values go at the end of the argument list. Always attempt to return a meaningful value from a function if one is appropriate. Here is a slightly longer example: <programlisting role="php"> function connect(&$dsn, $persistent = false) { if (is_array($dsn)) { $dsninfo = &$dsn; } else { $dsninfo = DB::parseDSN($dsn); } if (!$dsninfo || !$dsninfo['phptype']) { return $this->raiseError(); } return true; } </programlisting> </para> </sect1> <sect1 id="pear.standards.comments"> <title>ã³ã¡ã³ã</title> <para> Inline documentation for classes should follow the PHPDoc convention, similar to Javadoc. More information about PHPDoc can be found here: <ulink url="&url.phpdoc;">&url.phpdoc;</ulink> </para> <para> Non-documentation comments are strongly encouraged. A general rule of thumb is that if you look at a section of code and think "Wow, I don't want to try and describe that", you need to comment it before you forget how it works. </para> <para> C++ style comments (/* */) and standard C comments (// ) are both fine. Use of perl/shell style comments (# ) is discouraged. </para> </sect1> <sect1 id="pear.standards.including"> <title>ã³ã¼ãã®èªã¿è¾¼ã¿</title> <para> Anywhere you are unconditionally including a class file, use <function>require_once</function>. Anywhere you are conditionally including a class file (for example, factory methods), use <function>include_once</function>. Either of these will ensure that class files are included only once. They share the same file list, so you don't need to worry about mixing them - a file included with <function>require_once</function> will not be included again by <function>include_once</function>. <note> <simpara> <function>include_once</function> and <function>require_once</function> are statements, not functions. You don't <emphasis>need</emphasis> parentheses around the filename to be included. </simpara> </note> </para> </sect1> <sect1 id="pear.standards.tags"> <title>PHPã³ã¼ãã®ã¿ã°</title> <para> <emphasis>Always</emphasis> use <literal><?php ?></literal> to delimit PHP code, not the <literal><? ?></literal> shorthand. This is required for PEAR compliance and is also the most portable way to include PHP code on differing operating systems and setups. </para> </sect1> <sect1 id="pear.standards.header"> <title>ãããã®ã³ã¡ã³ãé¨</title> <para> All source code files in the core PEAR distribution should contain the following comment block as the header: <programlisting role="php"> /* vim: set expandtab tabstop=4 shiftwidth=4: */ // +----------------------------------------------------------------------+ // | PHP version 4.0 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Original Author <author@example.com> | // | Your Name <you@example.com> | // +----------------------------------------------------------------------+ // // $Id$ </programlisting> </para> <para> There's no hard rule to determine when a new code contributer should be added to the list of authors for a given source file. In general, their changes should fall into the "substantial" category (meaning somewhere around 10% to 20% of code changes). Exceptions could be made for rewriting functions or contributing new logic. </para> <para> Simple code reorganization or bug fixes would not justify the addition of a new individual to the list of authors. </para> <para> Files not in the core PEAR repository should have a similar block stating the copyright, the license, and the authors. All files should include the modeline comments to encourage consistency. </para> </sect1> <sect1 id="pear.standards.cvstags"> <title>CVS ã¿ã°</title> <para> Include the $Id$ CVS vendor tag in each file. As each file is edited, add this tag if it's not yet present (or replace existing forms such as "Last Modified:", etc.). <note> <simpara> We have a custom $Horde tag in Horde cvs to track our versions seperately; we could do the same and make a $PEAR tag, that would remain even if PEAR files were put into another source control system, etc...] </simpara> </note> </para> </sect1> <sect1 id="pear.standards.exampleurls"> <title>URLã®ä¾</title> <para> Use "example.com" for all example URLs, per RFC 2606. </para> </sect1> <sect1 id="pear.standards.constants"> <title>宿°ã®åå</title> <para> Constants should always be uppercase, with underscores to seperate words. Prefix constant names with the name of the class/package they are used in. For example, the constants used by the <literal>DB::</literal> package all begin with "<literal>DB_</literal>". </para> </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: -->
Index: phpdoc/en/functions/classobj.xml diff -u phpdoc/en/functions/classobj.xml:1.13 phpdoc/en/functions/classobj.xml:1.14 --- phpdoc/en/functions/classobj.xml:1.13 Wed Mar 7 15:15:13 2001 +++ phpdoc/en/functions/classobj.xml Fri Mar 9 07:33:03 2001 @@ -270,7 +270,7 @@ </informalexample> </para> <simpara> - See also <function>call_user_func_array</function>. + See also <function>call_user_func_array</function>, <function>call_user_func</function>, <function>call_user_method_array</function>. </simpara> Index: phpdoc/en/functions/info.xml diff -u phpdoc/en/functions/info.xml:1.39 phpdoc/en/functions/info.xml:1.40 --- phpdoc/en/functions/info.xml:1.39 Wed Mar 7 03:24:23 2001 +++ phpdoc/en/functions/info.xml Fri Mar 9 07:33:03 2001 @@ -1230,7 +1230,7 @@ <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>zendversion</function></funcdef> + <funcdef>string <function>zend_version</function></funcdef> <paramdef>void<parameter></parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1238,7 +1238,7 @@ Returns a string containing the version of the currently running PHP parser. <example> - <title>zendversion() example</title> + <title><function>zend_version</function> example</title> <programlisting role="php"> // prints e.g. 'Zend engine version: 1.0.4' echo "Zend engine version: ".zend_version(); Index: phpdoc/en/functions/var.xml diff -u phpdoc/en/functions/var.xml:1.35 phpdoc/en/functions/var.xml:1.36 --- phpdoc/en/functions/var.xml:1.35 Wed Mar 7 15:15:13 2001 +++ phpdoc/en/functions/var.xml Fri Mar 9 07:33:03 2001 @@ -146,7 +146,7 @@ <refnamediv> <refname>get_defined_vars</refname> <refpurpose> - Returns an array of all defined functions + Returns an array of all defined variables </refpurpose> </refnamediv> <refsect1> Index: phpdoc/ja/language-defs.ent diff -u phpdoc/ja/language-defs.ent:1.3 phpdoc/ja/language-defs.ent:1.4 --- phpdoc/ja/language-defs.ent:1.3 Sat Dec 16 19:37:13 2000 +++ phpdoc/ja/language-defs.ent Fri Mar 9 07:33:03 2001 @@ -5,5 +5,6 @@ <!ENTITY Features "æ©è½"> <!ENTITY FunctionReference "颿°ãªãã¡ã¬ã³ã¹"> <!ENTITY Appendixes "ä»é²"> +<!ENTITY PEAR "PEAR: the PHP Extension and Application Repository"> <!ENTITY available "available in"> Index: phpdoc/ja/chapters/install.xml diff -u phpdoc/ja/chapters/install.xml:1.26 phpdoc/ja/chapters/install.xml:1.27 --- phpdoc/ja/chapters/install.xml:1.26 Thu Mar 1 07:24:44 2001 +++ phpdoc/ja/chapters/install.xml Fri Mar 9 07:33:03 2001 @@ -4147,7 +4147,7 @@ . . . - .#注æ ãã®æ¬¡ã®è¡ã¯å ¨ã¦ã®'ObjectType'ã®å¾ã§ã'AddLog'è¡ã®åã¨ããå¿ è¦ãããã¾ã + .// 注æ ãã®æ¬¡ã®è¡ã¯å ¨ã¦ã®'ObjectType'ã®å¾ã§ã'AddLog'è¡ã®åã¨ããå¿ è¦ãããã¾ã Service fn="php4_execute" type="magnus-internal/x-httpd-php" . . @@ -4359,6 +4359,11 @@ æ£ããããã¨ããªãã§ãããããã°ã®ã¬ãã¼ãã¯ã<ulink url="&url.php.bugs;" >&url.php.bugs;</ulink>ã«ãããã°è¿½è·¡ã·ã¹ã ã ã使ç¨ãã¦ãè¡ããã¨ãã§ãã¾ãã + </simpara> + <simpara> + ãã°ã¬ãã¼ããæç¨¿ããåã« <ulink + url="&url.php.bugdosdonts;">Bugs-Dos-And-Donts</ulink> ãåç §ä¸ + ãã! </simpara> </sect2> Index: phpdoc/ja/functions/array.xml diff -u phpdoc/ja/functions/array.xml:1.20 phpdoc/ja/functions/array.xml:1.21 --- phpdoc/ja/functions/array.xml:1.20 Tue Feb 20 07:13:13 2001 +++ phpdoc/ja/functions/array.xml Fri Mar 9 07:33:03 2001 @@ -969,6 +969,42 @@ </refsect1> </refentry> + <refentry id="function.array-sum"> + <refnamediv> + <refname>array_sum</refname> + <refpurpose> + é åã®ä¸ã®å¤ã®åè¨ãè¨ç®ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>array_sum</function></funcdef> + <paramdef>array <parameter>arr</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>array_sum</function> ã¯ãé åã®ä¸ã®å¤ã®åè¨ãæ´æ°ã¾ã㯠+ floatã¨ãã¦è¿ãã¾ãã + </para> + <para> + <example> + <title><function>array_sum</function> ã®ä¾</title> + <programlisting role="php"> +$a = array(2,4,6,8); +echo "sum(a) = ".array_sum($a)."\n"; +// åºå: sum(a) = 20 + +$b = array("a"=>1.2,"b"=>2.3,"c"=>3.4); +echo "sum(b) = ".array_sum($b)."\n"; +// åºå: sum(b) = 6.9 + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.array-unique"> <refnamediv> <refname>array_unique</refname> Index: phpdoc/ja/functions/classobj.xml diff -u phpdoc/ja/functions/classobj.xml:1.8 phpdoc/ja/functions/classobj.xml:1.9 --- phpdoc/ja/functions/classobj.xml:1.8 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/classobj.xml Fri Mar 9 07:33:03 2001 @@ -161,6 +161,50 @@ </sect1> </partintro> + <refentry id="function.call-user-method-array"> + <refnamediv> + <refname>call_user_method_array</refname> + <refpurpose> + ãã©ã¡ã¼ã¿ã®é åãæå®ãã¦ã¦ã¼ã¶ã¡ã½ãããã³ã¼ã«ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed + <function>call_user_method_array</function> + </funcdef> + <paramdef>string + <parameter>method_name</parameter> + </paramdef> + <paramdef>object + <parameter>obj</parameter> + </paramdef> + <paramdef>array + <parameter><optional>paramarr</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã©ã¡ã¼ã¿ <parameter>paramarr</parameter> ã使ç¨ãã¦ã¦ã¼ã¶å®ç¾©ãª + ãã¸ã§ã¯ã <parameter>obj</parameter>ãã + <parameter>method_name</parameter>ã§åç §ãããã¡ã½ãããã³ã¼ã«ã + ã¾ãã + </para> + <para> + <function>call_user_func_array</function>, + <function>call_user_func</function>, + <function>call_user_method</function>ãåç §ä¸ããã + </para> + <note> + <para> + ãã®é¢æ°ã¯ãPHP 4.0.4pl1ã®ãªãªã¼ã¹å¾ã«CVSã³ã¼ãã«è¿½å ããã¾ããã + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.call-user-method"> <refnamediv> <refname>call_user_method</refname> @@ -230,7 +274,9 @@ </informalexample> </para> <simpara> - <function>call_user_func</function>ãåç §ä¸ããã + <function>call_user_func_array</function>, + <function>call_user_func</function>, + <function>call_user_method_array</function> ãåç §ä¸ããã </simpara> </refsect1> </refentry> Index: phpdoc/ja/functions/filesystem.xml diff -u phpdoc/ja/functions/filesystem.xml:1.26 phpdoc/ja/functions/filesystem.xml:1.27 --- phpdoc/ja/functions/filesystem.xml:1.26 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/filesystem.xml Fri Mar 9 07:33:03 2001 @@ -1146,7 +1146,7 @@ </itemizedlist> <parameter>mode</parameter> ã¯æå'b'ãæå®ãããã¨ãã§ãã¾ãã ããã¯ãã¤ããªã¨ããã¹ãã®ãã¡ã¤ã«å½¢å¼ãç°ãªãã·ã¹ãã ã§ã®ã¿æå¹ã§ãã - (ã¤ã¾ããUNIXã§ã¯ä¸è¦ã§ãã)å¿ è¦ããªãå ´åãç¡è¦ããã¾ãã + (Windowsã®å ´åã§ããUNIXã§ã¯ä¸è¦ã§ãã)ä¸è¦ã®å ´åãç¡è¦ããã¾ãã </para> <para> ãªãã·ã§ã³ã®2çªç®ã®å¼æ°ã使ç¨ãã¦ãããã«"1"ãè¨å®ãã @@ -1291,6 +1291,23 @@ </programlisting> </informalexample> </para> + <note> + <para> + ãã¤ããªã¨ããã¹ããã¡ã¤ã«ã®å½¢å¼ãç°ãªãã·ã¹ãã (ããªãã¡ + Windows)ã§ã¯ã<function>fopen</function>ã® mode ãã©ã¡ã¼ã¿ã«'b' + ãæå®ãã¦ãã¡ã¤ã«ããªã¼ãã³ããå¿ è¦ãããã¾ãã + </para> + </note> + <para> + <informalexample> + <programlisting role="php"> +$filename = "c:\\files\\somepic.gif"; +$fd = fopen ($filename, "rb"); +$contents = fread ($fd, filesize ($filename)); +fclose ($fd); + </programlisting> + </informalexample> + </para> <simpara> <function>fwrite</function>, <function>fopen</function>, <function>fsockopen</function>, <function>popen</function>, @@ -1804,6 +1821,25 @@ </para> <para> <function>is_readable</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.is-writeable"> + <refnamediv> + <refname>is_writeable</refname> + <refpurpose>ãã¡ã¤ã«ãæ¸ãè¾¼ã¿å¯è½ãã©ãã確èªãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>is_writeable</function></funcdef> + <paramdef>string <parameter>filename</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ã<function>is_writable</function>ã®ã¨ã¤ãªã¢ã¹ã§ãã </para> </refsect1> </refentry> Index: phpdoc/ja/functions/funchand.xml diff -u phpdoc/ja/functions/funchand.xml:1.5 phpdoc/ja/functions/funchand.xml:1.6 --- phpdoc/ja/functions/funchand.xml:1.5 Thu Mar 1 07:24:45 2001 +++ phpdoc/ja/functions/funchand.xml Fri Mar 9 07:33:03 2001 @@ -8,6 +8,65 @@ </para> </partintro> + <refentry id="function.call-user-func-array"> + <refnamediv> + <refname>call_user_func_array</refname> + <refpurpose> + ãã©ã¡ã¼ã¿ã®é åãæå®ãã¦ã¦ã¼ã¶é¢æ°ãã³ã¼ã«ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed + <function>call_user_func_array</function> + </funcdef> + <paramdef>string + <parameter>function_name</parameter> + </paramdef> + <paramdef>array + <parameter><optional>paramarr</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>paramarr</parameter> ã«ãã©ã¡ã¼ã¿ãæå®ãã¦ã + <parameter>function_name</parameter>ã§æå®ããã¦ã¼ã¶å®ç¾©é¢æ°ãã³ã¼ + ã«ãã¾ããä¾ãã°æ¬¡ã®ããã«ãªãã¾ãã + <informalexample> + <programlisting role="php"> +function debug($var, $val) + echo "***DEBUGGING\nVARIABLE: $var\nVALUE:"; + if (is_array($val) || is_object($val) || is_resource($val)) + print_r($val); + else + echo "\n$val\n"; + echo "***\n"; +} + +$c = mysql_connect(); +$host = $HTTP_SERVER_VARS["SERVER_NAME"]; + +call_user_func_array ('debug', array("host", $host)); +call_user_func_array ('debug', array("c", $c)); +call_user_func_array ('debug', array("HTTP_POST_VARS", $HTTP_POST_VARS)); + </programlisting> + </informalexample> + </para> + <para> + <function>call_user_func</function>, + <function>call_user_method</function>, + <function>call_user_method_array</function>ãåç §ä¸ããã + </para> + <note> + <para> + ãã®é¢æ°ã¯ãPHP 4.0.4pl1ã®ãªãªã¼ã¹å¾ã«CVSã³ã¼ãã«è¿½å ããã¾ããã + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.call-user-func"> <refnamediv> <refname>call_user_func</refname> @@ -50,6 +109,11 @@ </programlisting> </informalexample> </para> + <para> + <function>call_user_func_array</function>, + <function>call_user_method</function>, + <function>call_user_method_array</function>ãåç §ä¸ããã + </para> </refsect1> </refentry> @@ -385,6 +449,74 @@ </refsect1> </refentry> + <refentry id="function.get-defined-functions"> + <refnamediv> + <refname>get_defined_functions</refname> + <refpurpose> + å®ç¾©æ¸ã¿ã®å ¨ã¦ã®é¢æ°ãé åã§è¿ã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>get_defined_functions</function></funcdef> + <paramdef>void <parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãçµè¾¼(å é¨)颿°ããã³ã¦ã¼ã¶å®ç¾©é¢æ°ãå ±ã«å«ãå®ç¾©æ¸ã¿ + ã®å ¨ã¦ã®é¢æ°ã®ãªã¹ããæãã夿¬¡å é åãè¿ãã¾ããå é¨é¢æ°ã¯ã + <varname>$arr["internal"]</varname>ãã¦ã¼ã¶å®ç¾©é¢æ°ã¯ + <varname>$arr["user"]</varname> ã«ããã¢ã¯ã»ã¹å¯è½ã¨ãªãã¾ãã(以 + ä¸ã®ä¾ãåç §) + <informalexample> + <programlisting role="php"> +function myrow($id, $data) { + return "<tr><th>$id</th><td>$data</td></tr>\n"; +} + +$arr = get_defined_functions(); + +print_r($arr); + </programlisting> + </informalexample> + </para> + <para> + ãã®ä¾ã®åºåã¯ã以ä¸ã®ããã«ãªãã¾ãã + <informalexample> + <programlisting> +Array +( + [internal] => Array + ( + [0] => zend_version + [1] => func_num_args + [2] => func_get_arg + [3] => func_get_args + [4] => strlen + [5] => strcmp + [6] => strncmp + ... + [750] => bcscale + [751] => bccomp + ) + + [user] => Array + ( + [0] => myrow + ) + +) + </programlisting> + </informalexample> + </para> + <para> + <function>get_defined_vars</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.register-shutdown-function"> <refnamediv> <refname>register_shutdown_function</refname> Index: phpdoc/ja/functions/info.xml diff -u phpdoc/ja/functions/info.xml:1.20 phpdoc/ja/functions/info.xml:1.21 --- phpdoc/ja/functions/info.xml:1.20 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/info.xml Fri Mar 9 07:33:03 2001 @@ -786,7 +786,8 @@ </para> <para> <function>phpinfo</function>,<function>phpcredits</function>, - <function>php_logo_guid</function>ãåç §ä¸ããã + <function>php_logo_guid</function>,<function>zend_version</function> + ãåç §ä¸ããã </para> </refsect1> </refentry> @@ -1199,6 +1200,38 @@ <function>require_once</function>ã <function>include_once</function>ã <function>get_required_files</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.zend-version"> + <refnamediv> + <refname>zend_version</refname> + <refpurpose>ã«ã¬ã³ãã®Zendã¨ã³ã¸ã³ã®ãã¼ã¸ã§ã³ãåå¾ãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>zend_version</function></funcdef> + <paramdef>void<parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + PHPãã¼ãµãç¾å¨å®è¡ä¸ã®Zendã®ãã¼ã¸ã§ã³ãæååã¨ãã¦è¿ãã¾ãã + <example> + <title><function>zend_version</function>ã®ä¾</title> + <programlisting role="php"> +// ä¾ãã°ã'Zend engine version: 1.0.4' ãåºå +echo "Zend engine version: ".zend_version(); + </programlisting> + </example> + </para> + <para> + <function>phpinfo</function>, + <function>phpcredits</function>, + <function>php_logo_guid</function> + <function>phpversion</function>ãåç §ä¸ããã </para> </refsect1> </refentry> Index: phpdoc/ja/functions/oci8.xml diff -u phpdoc/ja/functions/oci8.xml:1.11 phpdoc/ja/functions/oci8.xml:1.12 --- phpdoc/ja/functions/oci8.xml:1.11 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/oci8.xml Fri Mar 9 07:33:03 2001 @@ -56,6 +56,41 @@ Webãµã¼ãã¼ã®ã¦ã¼ã¶ç¨ã«ç°å¢å¤æ°ãè¨å®ããå¾ãWebãµã¼ãã¼ã®ã¦ã¼ã¶ (nobody, www)ãã°ã«ã¼ãoracleã«è¿½å ãã¦ä¸ããã </para> + <note> + <title>Webãµã¼ããèµ·åããªãããèµ·åæã«ã¯ã©ãã·ã¥ããå ´å</title> + <para> + Apacheãpthreadã©ã¤ãã©ãªã«ãªã³ã¯ããã¦ãããã©ããæ¬¡ã®ããã«ç¢ºèª + ãã¦ä¸ããã + </para> + <para> + <informalexample> + <programlisting> +> ldd /www/apache/bin/httpd + libpthread.so.0 => /lib/libpthread.so.0 (0x4001c000) + libm.so.6 => /lib/libm.so.6 (0x4002f000) + libcrypt.so.1 => /lib/libcrypt.so.1 (0x4004c000) + libdl.so.2 => /lib/libdl.so.2 (0x4007a000) + libc.so.6 => /lib/libc.so.6 (0x4007e000) + /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) + </programlisting> + </informalexample> + </para> + <para> + libpthread ããã®ä¸è¦§ã«ãªãå ´åãApacheãåã¤ã³ã¹ãã¼ã«ããå¿ è¦ã + ããã¾ãã + </para> + <para> + <informalexample> + <programlisting> +> cd /usr/src/apache_1.3.xx +> make clean +> LIBS=-lpthread ./config.status +> make +> make install + </programlisting> + </informalexample> + </para> + </note> <para> <example> <title>OCIã«é¢ãããã³ã</title> Index: phpdoc/ja/functions/pdf.xml diff -u phpdoc/ja/functions/pdf.xml:1.18 phpdoc/ja/functions/pdf.xml:1.19 --- phpdoc/ja/functions/pdf.xml:1.18 Sat Mar 3 16:53:36 2001 +++ phpdoc/ja/functions/pdf.xml Fri Mar 9 07:33:03 2001 @@ -434,7 +434,7 @@ PDF_end_page($pdf); - # å¤åãè¦ãããã«å¾ 㤠+ /* å¤åãè¦ãããã«å¾ 㤠*/ sleep(1); } @@ -1128,16 +1128,16 @@ </refsect1> </refentry> - <refentry id="function.pdf-endpattern"> + <refentry id="function.pdf-end-pattern"> <refnamediv> - <refname>PDF_endpattern</refname> + <refname>PDF_end_pattern</refname> <refpurpose>ãã¿ã¼ã³ãçµäºãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>void <function>PDF_endpattern</function></funcdef> + <funcdef>void <function>PDF_end_pattern</function></funcdef> <paramdef>int <parameter>pdf object</parameter></paramdef> </funcprototype> </funcsynopsis> Index: phpdoc/ja/functions/var.xml diff -u phpdoc/ja/functions/var.xml:1.22 phpdoc/ja/functions/var.xml:1.23 --- phpdoc/ja/functions/var.xml:1.22 Thu Jan 4 22:29:05 2001 +++ phpdoc/ja/functions/var.xml Fri Mar 9 07:33:04 2001 @@ -60,7 +60,7 @@ <informalexample> <programlisting role="php"> $var = 0; -if ( empty($var) ) { #trueã¨è©ä¾¡ãããå ´å +if ( empty($var) ) { // trueã¨è©ä¾¡ãããå ´å print '$var is either 0 or not at all set'; } if ( !isset($var) ) { // falseã¨è©ä¾¡ãããå ´å @@ -140,6 +140,89 @@ </refsect1> </refentry> + <refentry id="function.get-defined-vars"> + <refnamediv> + <refname>get_defined_vars</refname> + <refpurpose> + å ¨ã¦ã®å®ç¾©æ¸ã®å¤æ°ãé åã§è¿ã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>get_defined_vars</function></funcdef> + <paramdef>void <parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãç°å¢å¤æ°ããµã¼ã夿°ãã¦ã¼ã¶ãå®ç¾©ãã夿°ãå«ãå ¨ã¦ + ã®å®ç¾©æ¸ã®å¤æ°ã®ãªã¹ããæãã夿¬¡å ã®é åãè¿ãã¾ãã + <informalexample> + <programlisting role="php"> +$b = array(1,1,2,3,5,8); + +$arr = get_defined_vars(); + +// $b ãåºå +print_r($arr["b"]); + +// PHPã¤ã³ã¿ããªã¿ã®ãã¹ãåºå (CGIã¨ãã¦ä½¿ç¨ãããå ´å) +// ä¾ãã°ã/usr/local/bin/php +echo $arr["_"]; + +// ã³ãã³ãã©ã¤ã³ãã©ã¡ã¼ã¿ãããå ´åã«åºå +print_r($arr["argv"]); + +// ãµã¼ã夿°ãå ¨ã¦è¡¨ç¤º +print_r($arr["HTTP_SERVER_VARS"]); + +// 夿°ã®é åã§å©ç¨å¯è½ãªãã¼ãå ¨ã¦åºå +print_r(array_keys(get_defined_vars())); + </programlisting> + </informalexample> + </para> + <para> + <function>get_defined_functions</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.get-resource-type"> + <refnamediv> + <refname>get_resource_type</refname> + <refpurpose>ãªã½ã¼ã¹åãè¿ã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>get_resource_type</function></funcdef> + <paramdef>resource <parameter>$handle</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãæå®ãããªã½ã¼ã¹ã®åã表ãæååãè¿ãã¾ãããã©ã¡ã¼ + ã¿ããæå¹ãªãªã½ã¼ã¹ã§ãªãå ´åã¯ã¨ã©ã¼ã¨ãªãã¾ãã + <informalexample> + <programlisting role="php"> +$c = mysql_connect(); +echo get_resource_type($c)."\n"; +// mysql link ãåºå + +$fp = fopen("foo","w"); +echo get_resource_type($fp)."\n"; +// file ãåºå + +$doc = new_xmldoc("1.0"); +echo get_resource_type($doc->doc)."\n"; +// domxml document ãåºå + </programlisting> + </informalexample> + </para> + </refsect1> + </refentry> + <refentry id="function.intval"> <refnamediv> <refname>intval</refname> @@ -388,6 +471,40 @@ </refsect1> </refentry> + <refentry id="function.is-null"> + <refnamediv> + <refname>is_null</refname> + <refpurpose> + 夿°ããã«ãã©ãã調ã¹ã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>is_null</function></funcdef> + <paramdef>mixed <parameter>var</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>var</parameter> ããã«ã®å ´åã«trueããã®ä»ã«falseãè¿ + ãã¾ãã + </para> + <para> + <function>is_bool</function>, + <function>is_double</function>, + <function>is_numeric</function>, + <function>is_float</function>, + <function>is_int</function>, + <function>is_real</function>, + <function>is_string</function>, + <function>is_object</function>, + <function>is_array</function>, + <function>is_integer</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.is-numeric"> <refnamediv> <refname>is_numeric</refname> @@ -509,6 +626,82 @@ </refsect1> </refentry> + <refentry id="function.is-scalar"> + <refnamediv> + <refname>is_scalar</refname> + <refpurpose> + 夿°ãã¹ã«ã©ã¼ãã©ããã調ã¹ã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool + <function>is_scalar</function> + </funcdef> + <paramdef>mixed + <parameter>var</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>is_scalar</function> returns true if the variable + given by the <parameter>var</parameter> parameter is a scalar, + otherwise it returns false. + </para> + <para> + Scalar variables are those containing an integer, float, string + or boolean. For example: + <informalexample> + <programlisting role="php"> +function show_var($var) { + if (is_scalar($var)) + echo $var; + else + var_dump($var); +} + +$pi = 3.1416; +$proteins = array("hemoglobin", "cytochrome c oxidase", "ferredoxin"); + +show_var($pi); +// prints: 3.1416 + +show_var($proteins) +// prints: +// array(3) { +// [0]=> +// string(10) "hemoglobin" +// [1]=> +// string(20) "cytochrome c oxidase" +// [2]=> +// string(10) "ferredoxin" +// } + </programlisting> + </informalexample> + </para> + <note> + <para> + ãã®é¢æ°ã¯ãPHP 4.0.4pl1 ã®ãªãªã¼ã¹ã³ã¼ãå¾ã«CVSã³ã¼ãã«è¿½å ãã + ã¾ããã4.0.4pl1 + </para> + </note> + <para> + <function>is_bool</function>, + <function>is_double</function>, + <function>is_numeric</function>, + <function>is_float</function>, + <function>is_int</function>, + <function>is_real</function>, + <function>is_string</function>, + <function>is_object</function>, + <function>is_array</function>, + <function>is_integer</function> ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.is-string"> <refnamediv> <refname>is_string</refname> Index: phpdoc/ja/functions/zlib.xml diff -u phpdoc/ja/functions/zlib.xml:1.9 phpdoc/ja/functions/zlib.xml:1.10 --- phpdoc/ja/functions/zlib.xml:1.9 Thu Mar 1 07:24:45 2001 +++ phpdoc/ja/functions/zlib.xml Fri Mar 9 07:33:04 2001 @@ -626,10 +626,10 @@ </funcprototype> </funcsynopsis> <para> - ãã®é¢æ°ã¯ãå ¥å<parameter>data</parameter>ãdeflateã¢ã«ã´ãªãºã - ã«ããgzipå§ç¸®ããããã®ãè¿ããã¨ã©ã¼ã®å ´åã«falseãè¿ãã¾ãã - ãªãã·ã§ã³ã®ãã©ã¡ã¼ã¿<parameter>level</parameter>ã«ã¯ã - 0ã§å§ç¸®ç¡ãã9ã§æå¤§éã®å§ç¸®ãæå®ã§ãã¾ãã + ãã®é¢æ°ã¯ãå ¥å<parameter>data</parameter>ãZLIBãã¼ã¿ãã©ã¼ãã + ããæãã¦compresså§ç¸®ããããã®ãè¿ããã¨ã©ã¼ã®å ´åã«falseãè¿ã + ã¾ãããªãã·ã§ã³ã®ãã©ã¡ã¼ã¿<parameter>level</parameter>ã«ã¯ã0ã§ + å§ç¸®ç¡ãã9ã§æå¤§éã®å§ç¸®ãæå®ã§ãã¾ãã </para> <note> <para> @@ -672,6 +672,130 @@ </para> <para> <function>gzcompress</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.gzdeflate"> + <refnamediv> + <refname>gzdeflate</refname> + <refpurpose>æååã deflate å§ç¸®ãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>gzdeflate</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>int + <parameter><optional>level</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãå ¥å <parameter>data</parameter> ãDEFLATEãã¼ã¿ãã©ã¼ + ããããç¨ãã¦å§ç¸®ãããã®ãè¿ãã¾ããã¨ã©ã¼ã®å ´åã«ã¯falseãè¿ã + ã¾ãããªãã·ã§ã³ã®ãã©ã¡ã¼ã¿<parameter>level</parameter>ã«ã¯ãå§ + 縮ããªãå ´åã«0ãæå¤§éã®å§ç¸®ãããå ´åã«9ãæå®å¯è½ã§ãã + </para> + <para> + DEFLATEå§ç¸®ã¢ã«ã´ãªãºã ã®è©³ç´°ã«ã¤ãã¦ã¯ãããã¥ã¡ã³ã + "<ulink url="&url.rfc1951;">DEFLATE Compressed Data Format + Specification version 1.3</ulink>" (RFC 1951)ãåç §ä¸ããã + </para> + <para> + <function>gzinflate</function>, + <function>gzcompress</function>, + <function>gzuncompress</function>, + <function>gzencode</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.gzinflate"> + <refnamediv> + <refname>gzinflate</refname> + <refpurpose>deflateå§ç¸®ãããæååãè§£åãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>gzinflate</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>int + <parameter><optional>length</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ã<function>gzdeflate</function>ã«ããå§ç¸®ããã + <parameter>data</parameter> ã弿°ã¨ããå§ç¸®åã®å ã®ãã¼ã¿ãè¿ã + ã¾ããã¨ã©ã¼ã®å ´åã«ã¯falseãè¿ãã¾ãããã®é¢æ°ã¯ãè§£åããããã¼ + ã¿ãå§ç¸®ãããå ¥å <parameter>data</parameter> ã®é·ãã®256åãã¾ + ãã¯ãªãã·ã§ã³ã®ãã©ã¡ã¼ã¿<parameter>length</parameter>以ä¸ã®é·ã + ã§ããå ´åã«ã¨ã©ã¼ãè¿ãã¾ãã + </para> + <para> + <function>gzcompress</function>. + <function>gzuncompress</function>, + <function>gzdeflate</function>, + <function>gzencode</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + + <refentry id="function.gzencode"> + <refnamediv> + <refname>gzencode</refname> + <refpurpose>gzip å§ç¸®ãããæååã使</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>gzencode</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>int + <parameter><optional>level</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ãã®é¢æ°ã¯ãå ¥å <parameter>data</parameter>ã + <command>gzip</command> ããã°ã©ã ã®åºåã¨äºææ§ã®ããå½¢å¼ã§å§ç¸® + ãã¦è¿ãã¾ããã¨ã©ã¼ãçºçããå ´åã¯ãfalseãè¿ãã¾ãããªãã·ã§ã³ + ã®ãã©ã¡ã¼ã¿<parameter>level</parameter> ã«ã¯ãå§ç¸®ãããªãå ´åã« + 0ãæå¤§éã®å§ç¸®ãè¡ãå ´åã«9ãæå®å¯è½ã§ããæå®ãããªãå ´åã®ã + ãã©ã«ãå§ç¸®ã¬ãã«ã¯1ã«ãªãã¾ãã + </para> + <para> + è¿ããããã¼ã¿ã«ã¯ãæ¨æºçãª.gzãã¡ã¤ã«ã¨ããããã«é©å½ãªããã㨠+ ãã¼ã¿æ§é ãå«ã¾ãã¾ããä¾ã以ä¸ã«ç¤ºãã¾ãã + <example> + <title>gzipãã¡ã¤ã«ã使ãã</title> + <programlisting role="php"> +<?php +$data = implode("", "bigfile.txt"); +$gzdata = gzencode($data, 9); +$fp = fopen("bigfile.txt.gz", "w"); +fwrite($fp, $gzdata); +fclose($fp); +?> + </programlisting> + </example> + </para> + <para> + GZIPãã¡ã¤ã«ãã©ã¼ãããã«é¢ããè©³ç´°ãªæ å ±ã«ã¤ãã¦ã¯ã次ã®ãã㥠+ ã¡ã³ããåç §ä¸ããã + <ulink url="&url.rfc1952">GZIP file format specification + version 4.3</ulink> (RFC 1952) + </para> + <para> + <function>gzcompress</function>. + <function>gzuncompress</function>, + <function>gzdeflate</function>, + <function>gzinflate</function>ãåç §ä¸ããã </para> </refsect1> </refentry> Index: phpdoc/ja/pear/about.xml +++ phpdoc/ja/pear/about.xml <chapter id="pear.about"> <title>PEARã«ã¤ãã¦</title> <simpara> PEAR ã¯ã1999/11/21 ã«çã¾ãã <ulink url="&url.malinimg;">Malin Bakken</ulink>ã«æ§ãããã¦ãã¾ãã(æåã®PEARã®ã³ã¼ãã¯ã彼女ãçã¾ ããã¡ããã©äºæéå¾ã«ãããã¾ããã) </simpara> <sect1 id="pear-whatis"> <title>PEARã¨ã¯?</title> <simpara> PEAR ã¯ãTeXã® CTAN ããã³ Perlã® CPANã«ãã³ããå¾ãPHPæ¡å¼µããã³ PHPã©ã¤ãã©ãªã®ã³ã¼ãç¨ã®ã³ã¼ãã¬ãã¸ããªã§ãã </simpara> <para> PEARã®ç®çã¯æ¬¡ã®ãããªãã®ã§ãã <itemizedlist> <listitem> <simpara> ã©ã¤ãã©ãªã³ã¼ãã®ä½è ã«ä»ã®éçºè ã¨ã³ã¼ããå ±æããããã®ç¢ºå® ãªææ®µãæä¾ãã </simpara> </listitem> <listitem> <simpara> PHPã³ãã¥ããã£ã«ã³ã¼ããå ±æããããã®ã¤ã³ãã©ãæä¾ãã </simpara> </listitem> <listitem> <simpara> éçºè ãç§»æ¤æ§ã®é«ãå使ç¨å¯è½ãªã³ã¼ããæ¸ããããããããã«æ¨ æºãå®ç¾©ãã </simpara> </listitem> <listitem> <simpara> ã³ã¼ãã®ç¶æç®¡çã¨é å¸ã®ããã®ãã¼ã«ãæä¾ãã </simpara> </listitem> </itemizedlist> </para> </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: --> Index: phpdoc/ja/pear/pear.xml +++ phpdoc/ja/pear/pear.xml <reference id="ref.pear"> <title>PEAR ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«</title> <titleabbrev>PEAR</titleabbrev> <partintro> <simpara> æ¬ç« ã¯ãPHPã«ä»å±ãã PEARã³ã³ãã¼ãã³ãã«é¢ãããªãã¡ã¬ã³ã¹ã§ãã ããã§ã¯ã<link linkend="language.oop">ãªãã¸ã§ã¯ãã¨ã¯ã©ã¹</link> ã«æ¢ã«æ £ãã¦ãããã¨ãåæã¨ãã¾ãã </simpara> </partintro> <refentry id="class.pear"> <refnamediv> <refname>PEAR</refname> <refpurpose>PEAR ãã¼ã¹ã¯ã©ã¹</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>class <replaceable>classname</replaceable> extends <classname>PEAR</classname> { ... }</synopsis> </refsynopsisdiv> <refsect1> <title>説æ</title> <simpara> PEARãã¼ã¹ã¯ã©ã¹ã¯ãå¤ãã®PEARã¯ã©ã¹ã§ä½¿ç¨ãããæ¨æºçãªæ©è½ãæ ä¾ãã¾ããé常ãPEARã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ãç´æ¥ä½æãããã¨ã¯ãã ã¾ããããã®ã¯ã©ã¹ã®ãµãã¯ã©ã¹åãã¦ä½¿ç¨ãã¦ä¸ããã </simpara> <para> ä¸»ãªæ©è½ã以ä¸ã«ç¤ºãã¾ãã <itemizedlist> <listitem> <simpara>ãªãã¸ã§ã¯ãçµäºå¦ç "ãã¹ãã©ã¯ã¿"</simpara> </listitem> <listitem> <simpara>ã¨ã©ã¼å¦ç</simpara> </listitem> </itemizedlist> </para> <refsect2> <title>PEAR "ãã¹ãã©ã¯ã¿"</title> <simpara> If you inherit <classname>PEAR</classname> in a class called <replaceable>ClassName</replaceable>, you can define a method in it called called _<replaceable>ClassName</replaceable> (the class name with an underscore prepended) that will be invoked when the request is over. This is not a destructor in the sense that you can "delete" an object and have the destructor called, but in the sense that PHP gives you a callback in the object when it is done executing. See <link linkend="example.pear.destructors">the example</link> below. </simpara> </refsect2> <refsect2> <title>PEARã®ã¨ã©ã¼å¦ç</title> <simpara> PEAR's base class also provides a way of passing around more complex errors than a true/false value or a numeric code. A PEAR error is an object that is either an instance of the class <classname>PEAR_Error</classname>, or some class inheriting <classname>PEAR_Error</classname>. </simpara> <simpara> One of the design criteria of PEAR's errors is that it should not force a particular type of output on the user, it should be possible to handle errors without any output at all if that is desireable. This makes it possible to handle errors gracefully, also when your output format is different from HTML (for example WML or some other XML format). </simpara> <simpara> The error object can be configured to do a number of things when it is created, such as printing an error message, printing the message and exiting, raising an error with PHP's <function>trigger_error</function> function, invoke a callback, or none of the above. This is typically specified in <classname>PEAR_Error</classname>'s constructor, but all of the parameters are optional, and you can set up defaults for errors generated from each object based on the <classname>PEAR</classname> class. See the <link linkend="example.pear.error1">PEAR error examples</link> for how to use it and the <classname>PEAR_Error</classname> reference for the full details. </simpara> </refsect2> </refsect1> <refsect1> <title>ä¾</title> <para> The example below shows how to use the PEAR's "poor man's kinda emulated destructors" to implement a simple class that holds the contents of a file, lets you append data to the object and flushes the data back to the file at the end of the request: <example id="example.pear.destructors"> <title>PEAR: emulated destructors</title> <programlisting role="php"> require_once "PEAR.php"; class FileContainer extends PEAR { var $file = ''; var $contents = ''; var $modified = 0; function FileContainer($file) { $this->PEAR(); // this calls the parent class constructor $fp = fopen($file, "r"); if (!is_resource($fp)) { return; } while (!empty($data = fread($fp, 2048))) { $this->contents .= $data; } fclose($fp); } function append($str) { $this->contents .= $str; $this->modified++; } // The "destructor" is named like the constructor // but with an underscore in front. function _FileContainer() { if ($this->modified) { $fp = fopen($this->file, "w"); if (!is_resource($fp)) { return; } fwrite($fp, $this->contents); fclose($fp); } } } $fileobj = new FileContainer("testfile"); $fileobj->append("this ends up at the end of the file\n"); // When the request is done and PHP shuts down, $fileobj's // "destructor" is called and updates the file on disk. </programlisting> </example> <note> <simpara> PEAR "destructors" use PHP's shutdown callbacks (<function>register_shutdown_function</function>), and you can't output anything from these when PHP is running in a web server. So anything printed in a "destructor" gets lost except when PHP is used in command-line mode. Bummer. </simpara> </note> </para> <simpara> The next examples illustrate different ways of using PEAR's error handling mechanism. </simpara> <para> <example id="example.pear.error1"> <title>PEAR error ã®ä¾ (1)</title> <programlisting role="php"> function mysockopen($host = "localhost", $port = 8090) { $fp = fsockopen($host, $port, $errno, $errstr); if (!is_resource($fp)) { return new PEAR_Error($errstr, $errno); } return $fp; } $sock = mysockopen(); if (PEAR::isError($sock)) { print "mysockopen error: ".$sock->getMessage()."<BR>\n" } </programlisting> </example> </para> <simpara> This example shows a wrapper to <function>fsockopen</function> that delivers the error code and message (if any) returned by fsockopen in a PEAR error object. Notice that <function>PEAR::isError</function> is used to detect whether a value is a PEAR error. </simpara> <simpara> PEAR_Error's mode of operation in this example is simply returning the error object and leaving the rest to the user (programmer). This is the default error mode. </simpara> <simpara> In the next example we're showing how to use default error modes: </simpara> <para> <example id="example.pear.error2"> <title>PEAR error example (2)</title> <programlisting role="php"> class TCP_Socket extends PEAR { var $sock; function TCP_Socket() { $this->PEAR(); } function connect($host, $port) { $sock = fsockopen($host, $port, $errno, $errstr); if (!is_resource($sock)) { return $this->raiseError($errstr, $errno); } } } $sock = new TCP_Socket; $sock->setErrorHandling(PEAR_ERROR_DIE); $sock->connect("localhost", 8090); print "still alive<BR>\n"; </programlisting> </example> </para> <simpara> Here, we set the default error mode to <constant>PEAR_ERROR_DIE</constant>, and since we don't specify any error mode in the raiseError call (that'd be the third parameter), raiseError uses the default error mode and exits if fsockopen fails. </simpara> </refsect1> </refentry> <refentry id="class.pear-error"> <refnamediv> <refname>PEAR_Error</refname> <refpurpose>PEARã¨ã©ã¼å¦çæ©è½ã®åºåºã¯ã©ã¹</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>$err = new <classname>PEAR_Error</classname>($msg);</synopsis> </refsynopsisdiv> <refsect1> <title>ã¨ã©ã¼ã¢ã¼ã</title> <para> An error object has a mode of operation that can be set with one of the following constants: <variablelist id="pear.error-modes"> <varlistentry id="constant.pear-error-return"> <term>PEAR_ERROR_RETURN</term> <listitem> <simpara> Just return the object, don't do anything special in PEAR_Error's constructor. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-print"> <term>PEAR_ERROR_PRINT</term> <listitem> <simpara> Print the error message in the constructor. The execution is not interrupted. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-trigger"> <term>PEAR_ERROR_TRIGGER</term> <listitem> <simpara> Use PHP's <function>trigger_error</function> function to raise an internal error in PHP. The execution is aborted if you have defined your own PHP error handler or if you set the error severity to E_USER_ERROR. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-die"> <term>PEAR_ERROR_DIE</term> <listitem> <simpara> Print the error message and exit. Execution is of course aborted. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-callback"> <term>PEAR_ERROR_CALLBACK</term> <listitem> <simpara> Use a callback function or method to handle errors. Execution is aborted. </simpara> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1> <title>ããããã£</title> <simpara></simpara> </refsect1> <refsect1> <title>ã¡ã½ãã</title> <funcsynopsis> <funcprototype> <funcdef><function>PEAR_Error::PEAR_Error</function></funcdef> <paramdef> <parameter><optional>message</optional></parameter> <parameter><optional>code</optional></parameter> <parameter><optional>mode</optional></parameter> <parameter><optional>options</optional></parameter> <parameter><optional>userinfo</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <refsect2> <title>説æ</title> <para> PEAR_Error constructor. Parameters: <variablelist> <varlistentry> <term>message</term> <listitem> <simpara> error message, defaults to "unknown error" </simpara> </listitem> </varlistentry> <varlistentry> <term>code</term> <listitem> <simpara> error code (optional) </simpara> </listitem> </varlistentry> <varlistentry> <term>mode</term> <listitem> <simpara> Mode of operation. See the <link linkend="pear.error-modes">error modes</link> section for details. </simpara> </listitem> </varlistentry> <varlistentry> <term>options</term> <listitem> <simpara> If the mode of can have any options specified, use this parameter. Currently the "trigger" and "callback" modes are the only using the options parameter. For trigger mode, this parameter is one of <constant>E_USER_NOTICE</constant>, <constant>E_USER_WARNING</constant> or <constant>E_USER_ERROR</constant>. For callback mode, this parameter should contain either the callback function name (string), or a two-element (object, string) array representing an object and a method name. </simpara> </listitem> </varlistentry> </variablelist> </para> </refsect2> </refsect1> </refentry> </reference> <!-- 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: --> Index: phpdoc/ja/pear/standards.xml +++ phpdoc/ja/pear/standards.xml <chapter id="pear.standards"> <title>PEAR ã³ã¼ãã£ã³ã°æ¨æº</title> <sect1 id="pear.standards.indenting"> <title>ã¤ã³ãã³ã</title> <para> Use an indent of 4 spaces, with no tabs. If you use Emacs to edit PEAR code, you should set indent-tabs-mode to nil. Here is an example mode hook that will set up Emacs according to these guidelines (you will need to ensure that it is called when you are editing php files): <programlisting role="elisp"> (defun php-mode-hook () (setq tab-width 4 c-basic-offset 4 c-hanging-comment-ender-p nil indent-tabs-mode nil)) </programlisting> </para> <para>Here are vim rules for the same thing: <programlisting role="vim"> set expandtab set shiftwidth=4 set tabstop=4 </programlisting> </para> </sect1> <sect1 id="pear.standards.control"> <title>å¶å¾¡æ§é </title> <para> These include if, for, while, switch, etc. Here is an example if statement, since it is the most complicated of them: <programlisting role="php"> if ((condition1) || (condition2)) { action1; } elseif ((condition3) && (condition4)) { action2; } else { defaultaction; } </programlisting> </para> <simpara> Control statements should have one space between the control keyword and opening parenthesis, to distinguish them from function calls. </simpara> <simpara> You are strongly encouraged to always use curly braces even in situations where they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added. </simpara> <para> For switch statements: <programlisting role="php"> switch (condition) { case 1: action1; break; case 2: action2; break; default: defaultaction; break; } </programlisting> </para> </sect1> <sect1 id="pear.standards.funcalls"> <title>颿°ã®ã³ã¼ã«</title> <para> Functions should be called with no spaces between the function name, the opening parenthesis, and the first parameter; spaces between commas and each parameter, and no space between the last parameter, the closing parenthesis, and the semicolon. Here's an example: <programlisting role="php"> $var = foo($bar, $baz, $quux); </programlisting> </para> <para> As displayed above, there should be one space on either side of an equals sign used to assign the return value of a function to a variable. In the case of a block of related assignments, more space may be inserted to promote readability: <programlisting role="php"> $short = foo($bar); $long_variable = foo($baz); </programlisting> </para> </sect1> <sect1 id="pear.standards.funcdef"> <title>颿°ã®å®ç¾©</title> <para> Function declaractions follow the "one true brace" convention: <programlisting role="php"> function fooFunction($arg1, $arg2 = '') { if (condition) { statement; } return $val; } </programlisting> </para> <para> Arguments with default values go at the end of the argument list. Always attempt to return a meaningful value from a function if one is appropriate. Here is a slightly longer example: <programlisting role="php"> function connect(&$dsn, $persistent = false) { if (is_array($dsn)) { $dsninfo = &$dsn; } else { $dsninfo = DB::parseDSN($dsn); } if (!$dsninfo || !$dsninfo['phptype']) { return $this->raiseError(); } return true; } </programlisting> </para> </sect1> <sect1 id="pear.standards.comments"> <title>ã³ã¡ã³ã</title> <para> Inline documentation for classes should follow the PHPDoc convention, similar to Javadoc. More information about PHPDoc can be found here: <ulink url="&url.phpdoc;">&url.phpdoc;</ulink> </para> <para> Non-documentation comments are strongly encouraged. A general rule of thumb is that if you look at a section of code and think "Wow, I don't want to try and describe that", you need to comment it before you forget how it works. </para> <para> C++ style comments (/* */) and standard C comments (// ) are both fine. Use of perl/shell style comments (# ) is discouraged. </para> </sect1> <sect1 id="pear.standards.including"> <title>ã³ã¼ãã®èªã¿è¾¼ã¿</title> <para> Anywhere you are unconditionally including a class file, use <function>require_once</function>. Anywhere you are conditionally including a class file (for example, factory methods), use <function>include_once</function>. Either of these will ensure that class files are included only once. They share the same file list, so you don't need to worry about mixing them - a file included with <function>require_once</function> will not be included again by <function>include_once</function>. <note> <simpara> <function>include_once</function> and <function>require_once</function> are statements, not functions. You don't <emphasis>need</emphasis> parentheses around the filename to be included. </simpara> </note> </para> </sect1> <sect1 id="pear.standards.tags"> <title>PHPã³ã¼ãã®ã¿ã°</title> <para> <emphasis>Always</emphasis> use <literal><?php ?></literal> to delimit PHP code, not the <literal><? ?></literal> shorthand. This is required for PEAR compliance and is also the most portable way to include PHP code on differing operating systems and setups. </para> </sect1> <sect1 id="pear.standards.header"> <title>ãããã®ã³ã¡ã³ãé¨</title> <para> All source code files in the core PEAR distribution should contain the following comment block as the header: <programlisting role="php"> /* vim: set expandtab tabstop=4 shiftwidth=4: */ // +----------------------------------------------------------------------+ // | PHP version 4.0 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Original Author <author@example.com> | // | Your Name <you@example.com> | // +----------------------------------------------------------------------+ // // $Id$ </programlisting> </para> <para> There's no hard rule to determine when a new code contributer should be added to the list of authors for a given source file. In general, their changes should fall into the "substantial" category (meaning somewhere around 10% to 20% of code changes). Exceptions could be made for rewriting functions or contributing new logic. </para> <para> Simple code reorganization or bug fixes would not justify the addition of a new individual to the list of authors. </para> <para> Files not in the core PEAR repository should have a similar block stating the copyright, the license, and the authors. All files should include the modeline comments to encourage consistency. </para> </sect1> <sect1 id="pear.standards.cvstags"> <title>CVS ã¿ã°</title> <para> Include the $Id$ CVS vendor tag in each file. As each file is edited, add this tag if it's not yet present (or replace existing forms such as "Last Modified:", etc.). <note> <simpara> We have a custom $Horde tag in Horde cvs to track our versions seperately; we could do the same and make a $PEAR tag, that would remain even if PEAR files were put into another source control system, etc...] </simpara> </note> </para> </sect1> <sect1 id="pear.standards.exampleurls"> <title>URLã®ä¾</title> <para> Use "example.com" for all example URLs, per RFC 2606. </para> </sect1> <sect1 id="pear.standards.constants"> <title>宿°ã®åå</title> <para> Constants should always be uppercase, with underscores to seperate words. Prefix constant names with the name of the class/package they are used in. For example, the constants used by the <literal>DB::</literal> package all begin with "<literal>DB_</literal>". </para> </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: -->