hirokawa Mon Dec 24 10:01:28 2001 EDT Modified files: /phpdoc/en/functions array.xml fdf.xml /phpdoc/ja Translators /phpdoc/ja/functions fdf.xml strings.xml Log: modified encoding and translation updated.
Index: phpdoc/en/functions/array.xml diff -u phpdoc/en/functions/array.xml:1.143 phpdoc/en/functions/array.xml:1.144 --- phpdoc/en/functions/array.xml:1.143 Thu Dec 20 19:55:20 2001 +++ phpdoc/en/functions/array.xml Mon Dec 24 10:01:24 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.143 $ --> +<!-- $Revision: 1.144 $ --> <reference id="ref.array"> <title>Array Functions</title> <titleabbrev>Arrays</titleabbrev> @@ -1444,6 +1444,12 @@ </refsect1> </refentry> + + <parameter>num</parameter> entries of the value of the + <parameter>value</parameter> parameter, keys starting at the + <parameter>start_index</parameter> parameter. + </para> + <refentry id="function.array-shift"> <refnamediv> <refname>array_shift</refname> Index: phpdoc/en/functions/fdf.xml diff -u phpdoc/en/functions/fdf.xml:1.25 phpdoc/en/functions/fdf.xml:1.26 --- phpdoc/en/functions/fdf.xml:1.25 Sat Dec 15 09:36:35 2001 +++ phpdoc/en/functions/fdf.xml Mon Dec 24 10:01:24 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.25 $ --> +<!-- $Revision: 1.26 $ --> <reference id="ref.fdf"> <title>Forms Data Format functions</title> <titleabbrev>FDF</titleabbrev> @@ -570,7 +570,7 @@ encoding in FDF document <parameter>fdf_document</parameter>. <parameter>encoding</parameter> should be the valid encoding name. The valid encoding name in Acrobat 5.0 are - "<literal>Shift_JIS</literal>", "<literal>UHC</literal>", + "<literal>Shift-JIS</literal>", "<literal>UHC</literal>", "<literal>GBK</literal>","<literal>BigFive</literal>". </para> <para> Index: phpdoc/ja/Translators diff -u phpdoc/ja/Translators:1.31 phpdoc/ja/Translators:1.32 --- phpdoc/ja/Translators:1.31 Fri Nov 23 20:54:50 2001 +++ phpdoc/ja/Translators Mon Dec 24 10:01:24 2001 @@ -1,36 +1,36 @@ -Files Translators +Files Translators Maintainers ============================================================================= -bookinfo.xml Rui Hirokawa -preface.xml Rui Hirokawa +bookinfo.xml Rui Hirokawa +preface.xml Rui Hirokawa ------- appendices ----------------------------------------------------------- -appendices/commandline.xml Rui Hirokawa -appendices/debugger.xml Michihide Hotta -appendices/escaping.xml Rui Hirokawa -appendices/history.xml Rui Hirokawa -appendices/http-stuff.xml Rui Hirokawa -appendices/migration.xml Michihide Hotta -appendices/migration4.xml Rui Hirokawa -appendices/phpdevel.xml Rui Hirokawa -appendices/regexp.xml Rui Hirokawa -appendices/reserved.xml Rui Hirokawa +appendices/about.xml Masaki Fujimoto Masaki Fujimoto +appendices/commandline.xml Rui Hirokawa +appendices/debugger.xml Michihide Hotta +appendices/escaping.xml Rui Hirokawa +appendices/history.xml Rui Hirokawa +appendices/http-stuff.xml Rui Hirokawa +appendices/migration.xml Michihide Hotta +appendices/migration4.xml Rui Hirokawa +appendices/phpdevel.xml Rui Hirokawa +appendices/regexp.xml Rui Hirokawa +appendices/reserved.xml Rui Hirokawa ------- chapters ------------------------------------------------------------ -chapters/config.xml Rui Hirokawa -chapters/copyright.xml Rui Hirokawa -chapters/install.xml Rui Hirokawa -chapters/intro.xml Rui Hirokawa -chapters/security.xml Rui Hirokawa +chapters/config.xml Rui Hirokawa +chapters/install.xml Rui Hirokawa +chapters/intro.xml Rui Hirokawa +chapters/security.xml Rui Hirokawa ------- faq ------------------------------------------------------------ -faq/build.xml Rui Hirokawa -faq/databases.xml Masaki Fujimoto -faq/general.xml Masaki Fujimoto -faq/installation.xml Masaki Fujimoto -faq/languages.xml Masaki Fujimoto -faq/mailinglist.xml Masaki Fujimoto -faq/migration.xml Masaki Fujimoto -faq/migration4.xml Masaki Fujimoto -faq/misc.xml Masaki Fujimoto -faq/obtaining.xml Masaki Fujimoto -faq/using.xml Masaki Fujimoto +faq/build.xml Rui Hirokawa Masaki Fujimoto +faq/databases.xml Masaki Fujimoto +faq/general.xml Masaki Fujimoto +faq/installation.xml Masaki Fujimoto +faq/languages.xml Masaki Fujimoto +faq/mailinglist.xml Masaki Fujimoto +faq/migration.xml Masaki Fujimoto +faq/migration4.xml Masaki Fujimoto +faq/misc.xml Masaki Fujimoto +faq/obtaining.xml Masaki Fujimoto +faq/using.xml Masaki Fujimoto ------- features ------------------------------------------------------------ features/connection-handling.xml Rui Hirokawa features/cookies.xml Rui Hirokawa @@ -42,112 +42,112 @@ features/remote-files.xml Rui Hirokawa features/safe-mode.xml Rui Hirokawa ------- functions ----------------------------------------------------------- -functions/adabas.xml Rui Hirokawa -functions/apache.xml Rui Hirokawa -functions/array.xml Michihide Hotta -functions/aspell.xml Rui Hirokawa -functions/bc.xml Rui Hirokawa -functions/bzip2.xml Rui Hirokawa -functions/calendar.xml Machino Satoshi -functions/ccvs.xml Rui Hirokawa -functions/classobj.xml Rui Hirokawa -functions/cpdf.xml Rui Hirokawa -functions/ctype.xml Rui Hirokawa -functions/curl.xml Rui Hirokawa -functions/cybercash.xml Rui Hirokawa -functions/datetime.xml Rui Hirokawa -functions/dba.xml Rui Hirokawa -functions/dbase.xml Rui Hirokawa -functions/dbm.xml Michihide Hotta -functions/dbx.xml Rui Hirokawa -functions/dir.xml Rui Hirokawa -functions/dl.xml Chihiro Higuchi -functions/domxml.xml Rui Hirokawa -functions/errorfunc.xml Rui Hirokawa -functions/exec.xml Rui Hirokawa -functions/fbsql.xml Rui Hirokawa -functions/fdf.xml Rui Hirokawa -functions/filepro.xml Rui Hirokawa -functions/filesystem.xml Rui Hirokawa -functions/ftp.xml Rui Hirokawa -functions/funchand.xml Rui Hirokawa -functions/gettext.xml Rui Hirokawa -functions/gmp.xml Rui Hirokawa -functions/http.xml Michihide Hotta -functions/hw.xml Rui Hirokawa -functions/ibase.xml Rui Hirokawa -functions/icap.xml Rui Hirokawa -functions/iconv.xml Rui Hirokawa -functions/ifx.xml Rui Hirokawa -functions/image.xml Chihiro Higuchi -functions/imap.xml Michihide Hotta -functions/info.xml Michihide Hotta -functions/ingres_ii.xml Rui Hirokawa -functions/java.xml Rui Hirokawa -functions/mail.xml Rui Hirokawa -functions/math.xml Machino Satoshi -functions/mbstring.xml Rui Hirokawa -functions/mcal.xml Rui Hirokawa -functions/mcrypt.xml Rui Hirokawa -functions/mhash.xml Rui Hirokawa -functions/ming.xml Rui Hirokawa -functions/misc.xml Michihide Hotta -functions/mnogosearch.xml Rui Hirokawa -functions/mssql.xml Rui Hirokawa -functions/mysql.xml Kazuhiro Ogura -functions/network.xml Chihiro Higuchi -functions/nis.xml Rui Hirokawa -functions/oci8.xml Rui Hirokawa -functions/openssl.xml Rui Hirokawa -functions/oracle.xml Rui Hirokawa -functions/ovrimos.xml Rui Hirokawa -functions/overload.xml Rui Hirokawa -functions/outcontrol.xml Rui Hirokawa -functions/pcre.xml Rui Hirokawa -functions/pcntl.xml Rui Hirokawa -functions/pdf.xml Rui Hirokawa -functions/pfpro.xml Rui Hirokawa -functions/pgsql.xml Rui Hirokawa -functions/posix.xml Rui Hirokawa -functions/printer.xml Rui Hirokawa -functions/pspell.xml Rui Hirokawa -functions/recode.xml Rui Hirokawa -functions/regex.xml Rui Hirokawa -functions/satellite.xml Rui Hirokawa -functions/sem.xml Rui Hirokawa -functions/session.xml Rui Hirokawa -functions/shmop.xml Rui Hirokawa -functions/snmp.xml Chihiro Higuchi -functions/solid.xml Rui Hirokawa -functions/socket.xml Rui Hirokawa -functions/strings.xml Rui Hirokawa -functions/swf.xml Rui Hirokawa -functions/sybase.xml Rui Hirokawa -functions/uodbc.xml Rui Hirokawa -functions/url.xml Chihiro Higuchi -functions/var.xml Michihide Hotta -functions/vmailmgr.xml Rui Hirokawa -functions/wddx.xml Rui Hirokawa -functions/xml.xml Rui Hirokawa -functions/xslt.xml Rui Hirokawa -functions/yaz.xml Rui Hirokawa -functions/zlib.xml Rui Hirokawa +functions/adabas.xml Rui Hirokawa +functions/apache.xml Rui Hirokawa +functions/array.xml Michihide Hotta +functions/aspell.xml Rui Hirokawa +functions/bc.xml Rui Hirokawa +functions/bzip2.xml Rui Hirokawa +functions/calendar.xml Machino Satoshi +functions/ccvs.xml Rui Hirokawa +functions/classobj.xml Rui Hirokawa +functions/cpdf.xml Rui Hirokawa +functions/ctype.xml Rui Hirokawa +functions/curl.xml Rui Hirokawa +functions/cybercash.xml Rui Hirokawa +functions/datetime.xml Rui Hirokawa +functions/dba.xml Rui Hirokawa +functions/dbase.xml Rui Hirokawa +functions/dbm.xml Michihide Hotta +functions/dbx.xml Rui Hirokawa +functions/dir.xml Rui Hirokawa +functions/dl.xml Chihiro Higuchi +functions/domxml.xml Rui Hirokawa +functions/errorfunc.xml Rui Hirokawa +functions/exec.xml Rui Hirokawa +functions/fbsql.xml Rui Hirokawa +functions/fdf.xml Rui Hirokawa +functions/filepro.xml Rui Hirokawa +functions/filesystem.xml Rui Hirokawa +functions/ftp.xml Rui Hirokawa +functions/funchand.xml Rui Hirokawa +functions/gettext.xml Rui Hirokawa +functions/gmp.xml Rui Hirokawa +functions/http.xml Michihide Hotta +functions/hw.xml Rui Hirokawa +functions/ibase.xml Rui Hirokawa +functions/icap.xml Rui Hirokawa +functions/iconv.xml Rui Hirokawa +functions/ifx.xml Rui Hirokawa +functions/image.xml Chihiro Higuchi +functions/imap.xml Michihide Hotta +functions/info.xml Michihide Hotta +functions/ingres_ii.xml Rui Hirokawa +functions/java.xml Rui Hirokawa +functions/mail.xml Rui Hirokawa +functions/math.xml Machino Satoshi +functions/mbstring.xml Rui Hirokawa +functions/mcal.xml Rui Hirokawa +functions/mcrypt.xml Rui Hirokawa +functions/mhash.xml Rui Hirokawa +functions/ming.xml Rui Hirokawa +functions/misc.xml Michihide Hotta +functions/mnogosearch.xml Rui Hirokawa +functions/mssql.xml Rui Hirokawa +functions/mysql.xml Kazuhiro Ogura +functions/network.xml Chihiro Higuchi +functions/nis.xml Rui Hirokawa +functions/oci8.xml Rui Hirokawa +functions/openssl.xml Rui Hirokawa +functions/oracle.xml Rui Hirokawa +functions/ovrimos.xml Rui Hirokawa +functions/overload.xml Rui Hirokawa +functions/outcontrol.xml Rui Hirokawa +functions/pcre.xml Rui Hirokawa +functions/pcntl.xml Rui Hirokawa +functions/pdf.xml Rui Hirokawa +functions/pfpro.xml Rui Hirokawa +functions/pgsql.xml Rui Hirokawa +functions/posix.xml Rui Hirokawa +functions/printer.xml Rui Hirokawa +functions/pspell.xml Rui Hirokawa +functions/recode.xml Rui Hirokawa +functions/regex.xml Rui Hirokawa +functions/satellite.xml Rui Hirokawa +functions/sem.xml Rui Hirokawa +functions/session.xml Rui Hirokawa +functions/shmop.xml Rui Hirokawa +functions/snmp.xml Chihiro Higuchi +functions/solid.xml Rui Hirokawa +functions/socket.xml Rui Hirokawa +functions/strings.xml Rui Hirokawa +functions/swf.xml Rui Hirokawa +functions/sybase.xml Rui Hirokawa +functions/uodbc.xml Rui Hirokawa +functions/url.xml Chihiro Higuchi +functions/var.xml Michihide Hotta +functions/vmailmgr.xml Rui Hirokawa +functions/wddx.xml Rui Hirokawa +functions/xml.xml Rui Hirokawa +functions/xslt.xml Rui Hirokawa +functions/yaz.xml Rui Hirokawa +functions/zlib.xml Rui Hirokawa -------- language ---------------------------------------------------------- -language/basic-syntax.xml Rui Hirokawa -language/constants.xml Rui Hirokawa -language/control-structures.xml Rui Hirokawa -language/expressions.xml Rui Hirokawa -language/functions.xml Rui Hirokawa -language/oop.xml Rui Hirokawa -language/operators.xml Rui Hirokawa -language/references.xml Rui Hirokawa -language/types.xml Rui Hirokawa -language/variables.xml Rui Hirokawa +language/basic-syntax.xml Rui Hirokawa +language/constants.xml Rui Hirokawa +language/control-structures.xml Rui Hirokawa +language/expressions.xml Rui Hirokawa +language/functions.xml Rui Hirokawa +language/oop.xml Rui Hirokawa +language/operators.xml Rui Hirokawa +language/references.xml Rui Hirokawa +language/types.xml Rui Hirokawa +language/variables.xml Rui Hirokawa -------- pear -------------------------------------------------------------- -pear/about.xml Rui Hirokawa -pear/benchmark_timer.xml Rui Hirokawa -pear/pear.xml Rui Hirokawa -pear/standards.xml Rui Hirokawa +pear/about.xml Rui Hirokawa +pear/benchmark_timer.xml Rui Hirokawa +pear/pear.xml Rui Hirokawa +pear/standards.xml Rui Hirokawa ---------------------------------------------------------------------------- Index: phpdoc/ja/functions/fdf.xml diff -u phpdoc/ja/functions/fdf.xml:1.11 phpdoc/ja/functions/fdf.xml:1.12 --- phpdoc/ja/functions/fdf.xml:1.11 Wed Dec 12 15:52:55 2001 +++ phpdoc/ja/functions/fdf.xml Mon Dec 24 10:01:25 2001 @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.12 $ --> <reference id="ref.fdf"> <title>Forms Data Format 関数</title> <titleabbrev>FDF</titleabbrev> @@ -28,7 +29,7 @@ ムのフォーマット自体(これは Portable Document Format、PDFです)です。 FDFデータの処理は、fdf関数に提供された機能の一つです。しかし機能は 他にもあります。既存のPDFフォームを用いてフォーム自体を修正せずに - 入力フィールドのデータを入力させることもあるかと思われます、 + +入力フィールドのデータを入力させることもあるかと思われます。 このような場合、FDFドキュメント を作成 (<function>fdf_create</function>)、各入力フィールドの値を設定 (<function>fdf_set_value</function>)、PDFフォームとそれを関連付け @@ -38,14 +39,31 @@ 読み込み、FDF ドキュメントからのデータを書き込みます。 </simpara> <simpara> - 次の例でフォームデータの評価に関して説明します。 + テキストエディタでFDFドキュメントの中を見てみると、 + +<literal>FDF</literal>という名前のカタログオブジェクトが見つかるは + ずです。このようなオブジェクトには、<literal>Fields</literal>, + <literal>F</literal>, <literal>Status</literal> といった複数のエン + トリが含まれます。 + +最も多く使用されるエントりは、一連の入力フィールドを指す + +<literal>Fields</literal>とこのデータが属するPDFドキュメントのファ + イル名を保持する<literal>F</literal> +です。これらのエントリは、 + FDFドキュメントの中で/F-Keyまたは +/Status-Keyのように参照されてい + ます。 <function>fdf_set_file</function>および + <function>fdf_set_status</function>のような関数によりこれらのエン + トリを修正することが可能です。Fields は、 + <function>fdf_set_value</function>,<function>fdf_set_opt</function> + 等で修整可能です。 + </simpara> + <simpara> + 以下の例でフォームデータの評価に関して説明します。 </simpara> <simpara> </simpara> <example> <title>FDF ドキュメントの評価</title> - <programlisting role="php"> -<?php + <programlisting> +<![CDATA[ +<?php // FDF データをテンポラリファイルに保存します。 $fdffp = fopen("test.fdf", "w"); fwrite($fdffp, $HTTP_FDF_DATA, strlen($HTTP_FDF_DATA)); @@ -57,27 +75,28 @@ // というチェックボックスを有します。 $fdf = fdf_open("test.fdf"); $volume = fdf_get_value($fdf, "volume"); -echo "volume フィールドは次の値を有します。 '<B>$volume</B>'<BR>"; +echo "volume フィールドは次の値を有します。 '<B>$volume</B>'<BR>"; $date = fdf_get_value($fdf, "date"); -echo "date フィールドは次の値を有します。 '<B>$date</B>'<BR>"; +echo "date フィールドは次の値を有します。 '<B>$date</B>'<BR>"; $comment = fdf_get_value($fdf, "comment"); -echo "comment フィールドは次の値を有します。 '<B>$comment</B>'<BR>"; +echo "comment フィールドは次の値を有します。 '<B>$comment</B>'<BR>"; if(fdf_get_value($fdf, "show_publisher") == "On") { $publisher = fdf_get_value($fdf, "publisher"); - echo "publisher フィールドは次の値を有します。 '<B>$publisher</B>'<BR>"; + echo "publisher フィールドは次の値を有します。 +'<B>$publisher</B>'<BR>"; } else - echo "publisher は、表示されません。<BR>"; + echo "publisher は、表示されません。<BR>"; if(fdf_get_value($fdf, "show_preparer") == "On") { $preparer = fdf_get_value($fdf, "preparer"); - echo "preparer フィールドは次の値を有します。 '<B>$preparer</B>'<BR>"; + echo "preparer フィールドは次の値を有します。 +'<B>$preparer</B>'<BR>"; } else - echo "preparer は、表示されません。<BR>"; + echo "preparer は、表示されません。<BR>"; fdf_close($fdf); ?> +]]> </programlisting> </example> @@ -108,8 +127,9 @@ <para> <example> <title>フォームデータをアクセスする</title> - <programlisting role="php"> -<?php + <programlisting> +<![CDATA[ +<?php // FDF データをテンポラリファイルに保存します $fdffp = fopen ("test.fdf", "w"); fwrite ($fdffp, $HTTP_FDF_DATA, strlen($HTTP_FDF_DATA)); @@ -120,6 +140,7 @@ ... fdf_close($fdf); ?> +]]> </programlisting> </example> </para> @@ -138,7 +159,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>boolean <function>fdf_close</function></funcdef> + <funcdef>bool <function>fdf_close</function></funcdef> <paramdef>int <parameter>fdf_document</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -173,8 +194,9 @@ <para> <example> <title>PDF ドキュメントを公開する</title> - <programlisting role="php"> -<?php + <programlisting> +<![CDATA[ +<?php $outfdf = fdf_create(); fdf_set_value($outfdf, "volume", $volume, 0); @@ -186,15 +208,14 @@ fpassthru($fp); unlink("outtest.fdf"); ?> - </programlisting> - </example></para> - +]]> + </programlisting> + </example> + </para> <para> - <function>fdf_close</function>, - <function>fdf_save</function>, - <function>fdf_open</function> - も参照下さい。</para> - + <function>fdf_close</function>, <function>fdf_save</function>, + <function>fdf_open</function> も参照下さい。 + </para> </refsect1> </refentry> @@ -212,20 +233,18 @@ </funcprototype> </funcsynopsis> <para> - <function>fdf_save</function> 関数はFDFドキュメントを - 保存します。FDFツールキットは、パラメータ - <parameter>filename</parameter> が '.'の場合、標準出力に - ドキュメントを出力する機能を提供しています。 - この機能は、PHPを Apache モジュールとして - 使用している場合は使用できません。 - この場合、ファイルに書き込み、使用する必要があります。 - 例えば、ファイルを出力するには - <function>fpassthru</function> を使用します。</para> - + <function>fdf_save</function> 関数はFDFドキュメントを保存します。 + FDFツールキットは、パラメータ<parameter>filename</parameter> が + +'.'の場合、標準出力にドキュメントを出力する機能を提供しています。 + +この機能は、PHPをApacheモジュールとして使用している場合は使用でき + +ません。この場合、何らかのファイルに書き込んだ後、例えば + <function>fpassthru</function> +を使用してこれを出力する必要があり + ます。 + </para> <para> - <function>fdf_create</function>の例としては - <function>fdf_close</function> も参照下さい。</para> - + <function>fdf_close</function>及び + <function>fdf_create</function>の例も参照下さい。 + </para> </refsect1> </refentry> @@ -261,7 +280,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>boolean <function>fdf_set_value</function></funcdef> + <funcdef>bool <function>fdf_set_value</function></funcdef> <paramdef>int <parameter>fdf_document</parameter></paramdef> <paramdef>string <parameter>fieldname</parameter></paramdef> <paramdef>string <parameter>value</parameter></paramdef> @@ -296,14 +315,14 @@ </funcsynopsis> <para> <function>fdf_next_field_name</function> 関数は - <parameter>fieldname</parameter> のフィールドの後の - フィールドの名前を返します。二番目のフィールドに&null;を指定した場合、 - 最初のフィールドの名前を返します。</para> - + <parameter>fieldname</parameter> のフィールドの後のフィールドの名 + 前を返します。二番目のフィールドに &null; +を指定した場合、最初の + フィールドの名前を返します。 + </para> <para> <function>fdf_set_field</function>, - <function>fdf_get_field</function> も参照下さい。</para> - + <function>fdf_get_field</function> も参照下さい。 + </para> </refsect1> </refentry> @@ -316,7 +335,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>boolean <function>fdf_set_ap</function></funcdef> + <funcdef>bool <function>fdf_set_ap</function></funcdef> <paramdef>int <parameter>fdf_document</parameter></paramdef> <paramdef>string <parameter>field_name</parameter></paramdef> <paramdef>int <parameter>face</parameter></paramdef> @@ -326,11 +345,11 @@ </funcsynopsis> <para> <function>fdf_set_ap</function> 関数はフィールドの外観 - (すなわち、/AP キーの値)を設定します。 - <parameter>face</parameter> には、 - 1=FDFNormalAP, 2=FDFRolloverAP, 3=FDFDownAP を - 設定可能です。</para> - + (すなわち、/AP キーの値)を設定します。 + <parameter>face</parameter> には、 + 1=FDFNormalAP, 2=FDFRolloverAP, 3=FDFDownAP を + 設定可能です。 + </para> </refsect1> </refentry> @@ -343,17 +362,18 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>boolean <function>fdf_set_status</function></funcdef> + <funcdef>bool <function>fdf_set_status</function></funcdef> <paramdef>int <parameter>fdf_document</parameter></paramdef> <paramdef>string <parameter>status</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - <function>fdf_set_status</function>は、/STATUS キーの値を設定します。</para> - + <function>fdf_set_status</function>は、/STATUS キーの値を設定しま + す。 + </para> <para> - <function>fdf_get_status</function> も参照下さい。</para> - + <function>fdf_get_status</function> も参照下さい。 + </para> </refsect1> </refentry> @@ -371,11 +391,12 @@ </funcprototype> </funcsynopsis> <para> - <function>fdf_get_status</function> は、/STATUS キーの値を返します。</para> - + <function>fdf_get_status</function> は、/STATUS キーの値を返しま + す。 + </para> <para> - <function>fdf_set_status</function> も参照下さい。</para> - + <function>fdf_set_status</function> も参照下さい。 + </para> </refsect1> </refentry> @@ -388,7 +409,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>boolean <function>fdf_set_file</function></funcdef> + <funcdef>bool <function>fdf_set_file</function></funcdef> <paramdef>int <parameter>fdf_document</parameter></paramdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> @@ -436,7 +457,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>boolean <function>fdf_set_flags</function></funcdef> + <funcdef>bool <function>fdf_set_flags</function></funcdef> <paramdef>int <parameter>fdf_document</parameter></paramdef> <paramdef>string <parameter>fieldname</parameter></paramdef> <paramdef>int <parameter>whichFlags</parameter></paramdef> @@ -462,7 +483,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>boolean <function>fdf_set_opt</function></funcdef> + <funcdef>bool <function>fdf_set_opt</function></funcdef> <paramdef>int <parameter>fdf_document</parameter></paramdef> <paramdef>string <parameter>fieldname</parameter></paramdef> <paramdef>int <parameter>element</parameter></paramdef> @@ -489,7 +510,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>boolean <function>fdf_set_submit_form_action</function></funcdef> + <funcdef>bool <function>fdf_set_submit_form_action</function></funcdef> <paramdef>int <parameter>fdf_document</parameter></paramdef> <paramdef>string <parameter>fieldname</parameter></paramdef> <paramdef>int <parameter>trigger</parameter></paramdef> @@ -517,7 +538,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>boolean <function>fdf_set_javascript_action</function></funcdef> + <funcdef>bool <function>fdf_set_javascript_action</function></funcdef> <paramdef>int <parameter>fdf_document</parameter></paramdef> <paramdef>string <parameter>fieldname</parameter></paramdef> <paramdef>int <parameter>trigger</parameter></paramdef> @@ -554,12 +575,35 @@ エンコーディングを設定します。<parameter>encoding</parameter> には有効なエンコーディング名を指定する必要があります。Acrobat 5.0 で使用可能なエンコーディング名は、 - "<literal>Shift_JIS</literal>", "<literal>UHC</literal>", + "<literal>Shift-JIS</literal>", "<literal>UHC</literal>", "<literal>GBK</literal>","<literal>BigFive</literal>"です。 </para> <para> - <function>fdf_set_encoding</function> は、PHP-4.0.7以降で使用可能 + <function>fdf_set_encoding</function> は、PHP-4.1.0以降で使用可能 です。 + </para> + </refsect1> + </refentry> + + <refentry id='function.fdf-add-template'> + <refnamediv> + <refname>fdf_add_template</refname> + <refpurpose>テンプレートをFDFに追加する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>fdf_add_template</function></funcdef> + <paramdef>int <parameter>fdfdoc</parameter></paramdef> + <paramdef>int <parameter>newpage</parameter></paramdef> + <paramdef>string <parameter>filename</parameter></paramdef> + <paramdef>string <parameter>template</parameter></paramdef> + <paramdef>int <parameter>rename</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + &warn.undocumented.func; </para> </refsect1> </refentry> Index: phpdoc/ja/functions/strings.xml diff -u phpdoc/ja/functions/strings.xml:1.47 phpdoc/ja/functions/strings.xml:1.48 --- phpdoc/ja/functions/strings.xml:1.47 Wed Dec 12 15:53:42 2001 +++ phpdoc/ja/functions/strings.xml Mon Dec 24 10:01:25 2001 @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.48 $ --> <reference id="ref.strings"> <title>Strings(文字列関数)</title> <titleabbrev>文字列</titleabbrev> <partintro> <simpara> - これらの関数群はすべて、文字列をいろいろな方法で操作します。 - 正規表現や URL ハンドリングの節にも関連する記述があります。 + +以下の関数はすべて、文字列をいろいろな方法で操作します。正規表現や + URL処理の節にも関連する記述があります。 </simpara> <para> 文字列の動作に関する情報、特にシングルクオート、ダブルクオート、エ @@ -51,7 +52,9 @@ <example> <title><function>addcslashes</function> の例</title> <programlisting role="php"> +<![CDATA[ $escaped = addcslashes($not_escaped, "\0..\37!@\177..\377"); +]]> </programlisting> </example> </para> @@ -60,9 +63,11 @@ する文字集合に含まれる文字の種類を把握するようにして下さい。 <informalexample> <programlisting role="php"> +<![CDATA[ echo addcslashes('foo[]', 'A..z'); // 全ての大文字と小文字はエスケープされます。 // ... しかし、[\]^_` および空白文字もエスケープされてしまいます。 +]]> </programlisting> </informalexample> また、指定した範囲の2番目の文字ではなく、最初の文字が小文字ASCII @@ -71,11 +76,13 @@ <function>ord</function> 関数を使用して下さい。 <informalexample> <programlisting role="php"> +<![CDATA[ echo addcslashes("zoo['.']", 'z..A'); /* 出力: \zoo['\.'] */ +]]> </programlisting> </informalexample> <note> @@ -187,16 +194,24 @@ <example> <title><function>chr</function>の例</title> <programlisting role="php"> +<![CDATA[ $str .= chr(27); /* $str の最後にエスケープ文字を付加する */ /* こちらの方がより便利なことが多い */ $str = sprintf("この文字列はエスケープで終了します: %c", 27); +]]> </programlisting> </example> + </para> + <para> + ASCIIテーブルを<ulink url="&url.asciitable;">&url.asciitable;</ulink> + で参照することが可能です。 + </para> + <para> この関数は<function>ord</function>の逆の動作をします。 - フォーマット文字列 <literal>%c</literal> を指定する - <function>sprintf</function> も参照下さい。 + <function>sprintf</function>のフォーマット文字列 + <literal>%c</literal>指定も参照下さい。 </para> </refsect1> </refentry> @@ -213,14 +228,10 @@ <funcdef>string <function>chunk_split</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int - <parameter> - <replaceable><optional>chunklen</optional></replaceable> - </parameter> + <parameter><optional>chunklen</optional></parameter> </paramdef> <paramdef>string - <parameter> - <replaceable><optional>end</optional></replaceable> - </parameter> + <parameter><optional>end</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> @@ -235,9 +246,11 @@ <example> <title><function>chunk_split</function>の例</title> <programlisting role="php"> +<![CDATA[ # RFC 2045 に基づき $data をフォーマットします $new_string = chunk_split (base64_encode($data)); +]]> </programlisting> </example> この関数は、<function>ereg_replace</function>よりも @@ -400,7 +413,7 @@ <refentry id="function.crypt"> <refnamediv> <refname>crypt</refname> - <refpurpose>文字列をDESで暗号化する</refpurpose> + +<refpurpose>文字列の一方向の暗号化(ハッシュ化)を行う</refpurpose> </refnamediv> <refsect1> <title>説明</title> @@ -433,9 +446,9 @@ 他の暗号化方式用のsaltを受付ます。saltが指定されない場合、システ ムのデフォルトの暗号化手法がMD5でない限りPHPはデフォルトで標準の2 文字DES saltを自動的に生成します。暗号化手法がMD5の場合、MD5互換 - のsaltが生成されます。PHPは、標準の2文字のsaltをシステムに適用す - るか、より長い12文字MD5 saltが適用できるかを意味する定数 - CRYPT_SALT_LENGTH を設定します。 + のsaltが生成されます。PHPは、定数CRYPT_SALT_LENGTH +を設定します。 + この定数により、標準の2文字のsaltまたはより長い12文字MD5 +saltのど + ちらが適用可能であるかを知ることが可能です。 </simpara> <simpara> 生成されたsaltを使用する場合、saltが生成されるのは一回限りである @@ -444,8 +457,11 @@ ります。 </simpara> <simpara> - 標準 DES 暗号化 <function>crypt</function> は、出力の最初の2文字 - をsaltとして使用します。 + 標準DES暗号<function>crypt</function>は、出力の最初の2文字をsalt + として使用します。 + <parameter>str</parameter>の最初の8文字を使用するだけです。 + +このため、(同じsaltを使用した場合、)同じ8文字から始まるより長い文 + 字列について同じ結果が生成されます。 </simpara> <simpara> crypt() 関数が複数の暗号化手法をサポートするシステムにおいては、 @@ -473,12 +489,33 @@ </simpara> </listitem> </itemizedlist> + <note> + <simpara> + <function>crypt</function> は単方向アルゴリズムを使用している + ため、復号化するための関数 (decrypt) はありません。 + </simpara> + </note> + <example> + <title><function>crypt</function>の例</title> + <programlisting role="php"> +<![CDATA[ +<?php +$password = crypt("My1sTpassword"); # saltを生成 + +# +異なったハッシュアルゴリズムが使用された際の問題を避けるために +# +crypt()の結果全体をパスワード比較用のsaltとして渡す必要があります。 +# +(上記のように標準DESに基づくパスワードハッシュは2文字のsaltを使用します +# が、MD5に基づくハッシュは12文字のsaltを使用します) +if (crypt($user_input,$password) == $password) { + echo "パスワードは検証されました!"; +} +?> +]]> + </programlisting> + </example> <simpara> - <function>crypt</function> は単方向アルゴリズムを使用している - ため、復号化するための関数 (decrypt) はありません。 - </simpara> - <simpara> - <function>md5</function>も参照下さい。 + <function>md5</function>および<link linkend="ref.mcrypt">mcrypt拡 + 張モジュール</link>も参照下さい。 </simpara> </refsect1> </refentry> @@ -495,9 +532,7 @@ <funcdef><function>echo</function></funcdef> <paramdef>string <parameter>arg1</parameter></paramdef> <paramdef>string - <parameter> - <replaceable><optional>argn</optional></replaceable> - ...</parameter> + <parameter><optional>argn</optional>...</parameter> </paramdef> </funcprototype> </funcsynopsis> @@ -512,7 +547,8 @@ <example> <title><function>echo</function> の例</title> <programlisting role="php"> -<?php +<![CDATA[ +<?php echo "Hello World"; echo "This spans @@ -536,6 +572,13 @@ echo $foo; // foobar echo $foo,$bar; // foobarbarbaz +echo <<<END +This uses the "here document" syntax to output +multiple lines with $variable interpolation. Note +that the here document terminator must appear on a +line with just a semicolon no extra whitespace! +END; + // echo は関数ではないので以下のコードは正しくありません ($some_var) ? echo('true'): echo('false'); @@ -543,6 +586,7 @@ ($some_var) ? print('true'): print('false'); // print は関数 echo $some_var ? 'true': 'false'; // 命令を変更 ?> +]]> </programlisting> </example> </para> @@ -551,7 +595,9 @@ を付ける省略形があります。 <informalexample> <programlisting role="php"> -I have <?=$foo?> foo. +<![CDATA[ +I have <?=$foo?> foo. +]]> </programlisting> </informalexample> </para> @@ -576,9 +622,7 @@ <paramdef>string <parameter>separator</parameter></paramdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int - <parameter> - <replaceable><optional>limit</optional></replaceable> - </parameter> + <parameter><optional>limit</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> @@ -608,14 +652,31 @@ <example> <title><function>explode</function> の例</title> <programlisting role="php"> +<![CDATA[ $pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza); + +$data = "foo:*:1023:1000::/home/foo:/bin/sh"; +list($user,$pass,$uid,$gid,$gecos,$home,$shell) = explode(":",$data); +]]> </programlisting> </example> </para> + <note> + <para> + +<function>implode</function>は、歴史的な理由によりパラメータをど + ちらの順番でも受けつけることができますが、 + <function>explode</function>はできません。 + <parameter>string</parameter>引数の前に必ず + <parameter>separator</parameter>引数がくるようにする必要がありま + す。 + </para> + </note> <para> - <function>split</function> および <function>implode</function> - を参照下さい。 + <function>preg_split</function>, + <function>spliti</function>, + <function>split</function>, + <function>implode</function>も参照下さい。 </para> </refsect1> </refentry> @@ -637,9 +698,7 @@ </funcdef> <paramdef>int <parameter>table</parameter></paramdef> <paramdef>int - <parameter> - <replaceable><optional>quote_style</optional></replaceable> - </parameter> + <parameter><optional>quote_style</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> @@ -647,8 +706,7 @@ <function>get_html_translation_table</function> は、 <function>htmlspecialchars</function> および <function>htmlentities</function> で内部的に使用される変換テーブ - ルを返します。 - テーブルを指定できるように新規に定義が2つ + +ルを返します。テーブルを指定できるように新規に定義が2つ (<parameter>HTML_ENTITIES</parameter>, <parameter>HTML_SPECIALCHARS</parameter>)追加されました。 <function>htmlspecialchars</function> および @@ -659,9 +717,11 @@ <example> <title>変換テーブルの例</title> <programlisting role="php"> +<![CDATA[ $trans = get_html_translation_table (HTML_ENTITIES); -$str = "Hallo & <Frau> & Krämer"; +$str = "Hallo & <Frau> & Krämer"; $encoded = strtr ($str, $trans); +]]> </programlisting> </example> 変数 <literal>$encoded</literal> は次のようになります。: "Hallo @@ -674,17 +734,14 @@ 良いでしょう。 <informalexample> <programlisting role="php"> +<![CDATA[ $trans = array_flip ($trans); $original = strtr ($str, $trans); +]]> </programlisting> </informalexample> <literal>$original</literal> の内容は次のようになります。: "Hallo & <Frau> & Krämer" - <note> - <para> - この関数は、PHP 4.0 で追加されました。 - </para> - </note> </para> <para> <function>htmlspecialchars</function>, @@ -720,9 +777,11 @@ <example> <title>メタタグの例</title> <programlisting role="html"> -<meta name="author" content="name"> -<meta name="tags" content="php3 documentation"> -</head> <!-- parsing stops here --> +<![CDATA[ +<meta name="author" content="name"> +<meta name="tags" content="php3 documentation"> +</head> <!-- parsing stops here --> +]]> </programlisting> </example> (行末に注意して下さい。PHPは入力の処理にシステム関数を使用します。 @@ -758,9 +817,7 @@ <funcdef>string <function>hebrev</function></funcdef> <paramdef>string <parameter>hebrew_text</parameter></paramdef> <paramdef>int - <parameter> - <replaceable><optional>max_chars_per_line</optional></replaceable> - </parameter> + <parameter><optional>max_chars_per_line</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> @@ -789,9 +846,7 @@ <funcdef>string <function>hebrevc</function></funcdef> <paramdef>string <parameter>hebrew_text</parameter></paramdef> <paramdef>int - <parameter> - <replaceable><optional>max_chars_per_line</optional></replaceable> - </parameter> + <parameter><optional>max_chars_per_line</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> @@ -852,6 +907,7 @@ <para> <function>htmlspecialchars</function>と同様に、この関数はオプショ ンの3番目の引数をとり、変換に使用される文字セットを指定可能です。 + この引数はPHP 4.1.0で追加されました。 </para> <para> <function>htmlspecialchars</function> および @@ -899,6 +955,9 @@ シングルおよびダブルクオートされた文字で関数が何を行うかを指定し ます。デフォルトのモード(ENT_COMPAT)は下位互換性を有しており、ダ ブルクオートされた文字を変換し、単純な引用のままにします。 + +ENT_QUOTESが設定されている場合、シングルクオート、ダブルクオート + +は共に変換され、ENT_NOQUOTESが設定されている場合、シングルクオー + ト、ダブルクオートは共に変換されません。 </simpara> <para> 変換対象となる文字は以下の通りです。 @@ -910,7 +969,14 @@ </listitem> <listitem> <simpara> - '"' (ダブルクォート)は '&quot;' になります。 + ENT_NOQUOTESが設定されていない場合、'"' +(ダブルクォート) + は '&quot;'になります。 + </simpara> + </listitem> + <listitem> + <simpara> + ENT_QUOTESが設定されている場合のみ、''' +(シングルクオート) + は '&#039;'になります。 </simpara> </listitem> <listitem> @@ -927,7 +993,9 @@ <example> <title><function>htmlspecialchars</function>の例</title> <programlisting role="php"> -$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); +<![CDATA[ +$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); +]]> </programlisting> </example> </para> @@ -939,7 +1007,8 @@ </para> <para> 3番目の引数は、変換に使用される文字セットを指定します。デフォルト - の文字セットは、ISO-8859-1です。 + +の文字セットは、ISO-8859-1です。3番目の引数のサポートは、PHP + 4.1.0で追加されました。 </para> <para> <function>htmlentities</function> および @@ -969,10 +1038,21 @@ <example> <title><function>implode</function>の例</title> <programlisting role="php"> -$colon_separated = implode (":", $array); +<![CDATA[ +$colon_separated = implode(":", $array); +]]> </programlisting> </example> </para> + <note> + <para> + +<function>implode</function>は、歴史的な理由により、引数をどちら + の順番でも受けつけることが可能です。しかし、 + <function>explode</function>との統一性の観点からは、 + +ドキュメントに記述された引数の順番を使用する方が混乱が少なくなる + でしょう。 + </para> + </note> <simpara> <function>explode</function>, <function>join</function>, <function>split</function>も参照下さい。 @@ -1289,22 +1369,24 @@ </informaltable> </para> <para> - The grouping fields contain arrays that define the way numbers should be grouped. - For example, the grouping field for the en_US locale, would contain a 2 item array - with the values 3 and 3. The higher the index in the array, the farther left the - grouping is. If an array element is equal to CHAR_MAX, no further grouping is done. - If an array element is equal to 0, the previous element should be used. + +groupingフィールドには、グループ化する方法を表す数字を定義する配 + +列が含まれます。例えば、en_USロケール用のgroupingフィールドには、 + +3、3を値とする要素数2の配列が含まれます。この配列のより高い添字に + は、より左側のグループに関するものが含まれます。 + +ある配列要素が、CHAR_MAXに等しい場合、さらにグループは行われませ + +ん。配列要素が0に等しい場合、前の要素が使用されています。 </para> <example> - <title><function>localeconv</function> example</title> + <title><function>localeconv</function>の例</title> <programlisting role="php"> +<![CDATA[ setlocale(LC_ALL, "en_US"); $locale_info = localeconv(); -echo "<PRE>\n"; +echo "<PRE>\n"; echo "--------------------------------------------\n"; -echo " カレントのロケールの通貨情報: \n"; +echo " カレントロケールの通貨情報: \n"; echo "--------------------------------------------\n\n"; echo "int_curr_symbol: {$locale_info["int_curr_symbol"]}\n"; @@ -1321,7 +1403,8 @@ echo "n_sep_by_space: {$locale_info["n_sep_by_space"]}\n"; echo "p_sign_posn: {$locale_info["p_sign_posn"]}\n"; echo "n_sign_posn: {$locale_info["n_sign_posn"]}\n"; -echo "</PRE>\n"; +echo "</PRE>\n"; +]]> </programlisting> </example> <para> @@ -1357,6 +1440,11 @@ </paramdef> </funcprototype> </funcsynopsis> + <note> + <simpara> + 2番目の引数はPHP 4.1.0で追加されました。 + </simpara> + </note> <para> この関数は文字列の最初から空白文字を取り除き、 取り除かれた文字列を返します。2番目のパラメータを指定しない場合、 @@ -1427,11 +1515,6 @@ </programlisting> </para> </example> - <note> - <simpara> - 2番目のパラメータは、PHP 4.0.7で追加されました。 - </simpara> - </note> <para> <function>trim</function> および <function>rtrim</function>も 参照下さい。 @@ -1455,10 +1538,42 @@ <para> <ulink url="&url.rfc;rfc1321.html">RSA Data Security, Inc.の MD5メッセージダイジェストアルゴリズム</ulink> を用いて - <parameter>str</parameter>のMD5ハッシュ値を計算しっY。 + +<parameter>str</parameter>のMD5ハッシュ値を計算し、そのハッシュを + 返します。このハッシュは、32文字の16進数となります。 + </para> + <para> + <function>crc32</function>および<function>md5_file</function>も参 + 照下さい。 + </para> + </refsect1> + </refentry> + + <refentry id="function.md5-file"> + <refnamediv> + <refname>md5_file</refname> + +<refpurpose>指定したファイルのMD5ハッシュ値を計算する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>md5_file</function></funcdef> + <paramdef>string <parameter>filename</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <ulink url="&url.rfc;rfc1321.html">RSA Data Security, Inc. + MD5 メッセージダイジェストアルゴリズム</ulink>を用いて + 指定した<parameter>filename</parameter>のMD5ハッシュを計算し、そ + のハッシュを返します。 </para> <para> - <function>crc32</function>も参照下さい。 + +この関数は、コマンドラインのユーティリティmd5sumと同一目的で使用 + されます。 + </para> + <para> + <function>md5</function>および<function>crc32</function>も参照下 + さい。 </para> </refsect1> </refentry> @@ -1491,11 +1606,6 @@ 開発されました。["Practical Algorithms for Programmers", Binstock & Rex, Addison Wesley, 1995] で解説されています。 - <note> - <para> - この関数は、PHP 4.0 で追加されました。 - </para> - </note> </para> </refsect1> </refentry> @@ -1553,12 +1663,18 @@ <example> <title><function>ord</function>の例</title> <programlisting role="php"> +<![CDATA[ if (ord ($str) == 10) { echo "\$str の先頭は改行文字です。\n"; } +]]> </programlisting> </example> </para> + <para> + ASCIIテーブルを<ulink url="&url.asciitable;" + >&url.asciitable;</ulink>で参照可能です。 + </para> <simpara> <function>chr</function>も参照下さい。 </simpara> @@ -1577,9 +1693,7 @@ <funcdef>void <function>parse_str</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>array - <parameter> - <replaceable><optional>arr</optional></replaceable> - </parameter> + <parameter><optional>arr</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> @@ -1593,14 +1707,20 @@ <example> <title><function>parse_str</function>の使用法</title> <programlisting role="php"> +<![CDATA[ $str = "first=value&second[]=this+works&second[]=another"; parse_str($str); echo $first; /* "value" を出力 */ echo $second[0]; /* "this works" を出力 */ echo $second[1]; /* "another" を出力 */ +]]> </programlisting> </example> </para> + <para> + <function>set_magic_quotes_runtime</function>および + <function>urldecode</function>も参照下さい。 + </para> </refsect1> </refentry> @@ -1618,8 +1738,47 @@ </funcprototype> </funcsynopsis> <simpara> - <parameter>arg</parameter>を出力します。 + <parameter>arg</parameter>を出力します。&return.success; </simpara> + <example> + <title><function>print</function>の例</title> + <programlisting role="php"> +<![CDATA[ +<?php +print("Hello World"); + +print "print() also works without parentheses."; + +print "This spans +multiple lines. The newlines will be +output as well"; + +print "This spans\nmultiple lines. The newlines will be\noutput as well."; + +print "escaping characters is done \"Like this\"." + +// print文の中で変数を使用することが可能です。 +$foo = "foobar"; +$bar = "barbaz"; + +print "foo is $foo"; // foo is foobar + +// +シングルクオートを使用すると値ではなく変数名が出力されます。 +print 'foo is $foo'; // foo is $foo + +// +他の文字を使用しない場合、変数だけを出力することが可能です。 +print $foo; // foobar + +print <<<END +This uses the "here document" syntax to output +multiple lines with $variable interpolation. Note +that the here document terminator must appear on a +line with just a semicolon no extra whitespace! +END; +?> +]]> + </programlisting> + </example> <simpara> <function>echo</function>、<function>printf</function>、 <function>flush</function>も参照下さい。 @@ -1630,18 +1789,17 @@ <refentry id="function.printf"> <refnamediv> <refname>printf</refname> - <refpurpose>文字列をフォーマットしっKら出力する</refpurpose> + <refpurpose>フォーマット済みの文字列を出力する</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>printf</function></funcdef> + <funcdef>void <function>printf</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>mixed - <parameter> - <replaceable><optional>args</optional></replaceable> - </parameter>...</paramdef> + <parameter><optional>args</optional></parameter>... + </paramdef> </funcprototype> </funcsynopsis> <simpara> @@ -1710,6 +1868,29 @@ </refsect1> </refentry> + <refentry id='function.str-rot13'> + <refnamediv> + <refname>str_rot13</refname> + <refpurpose>文字列にrot13変換を行う</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>str_rot13</function></funcdef> + <paramdef>string <parameter>str</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + +この関数は、<parameter>str</parameter>引数にROT13エンコードを行い、 + +結果の文字列を返します。ROT13は、各文字をアルファベット順に13文字 + +シフトさせ、アルファベット以外の文字はそのままとするエンコードを + +行います。エンコードとデコードは同じ関数で行われます。引数にエン + +コードされた文字列が指定された場合には、元の文字列が返されます。 + </para> + </refsect1> + </refentry> + <!-- this section is nearly-identical to trim, ltrim and rtrim --> <refentry id="function.rtrim"> <refnamediv> @@ -1727,6 +1908,11 @@ </paramdef> </funcprototype> </funcsynopsis> + <note> + <simpara> + 2番目のパラメータは、PHP 4.1.0で追加されました。 + </simpara> + </note> <para> この関数は文字列の最後から空白文字を取り除き、 取り除かれた文字列を返します。2番目のパラメータを指定しない場合、 @@ -1766,7 +1952,7 @@ <listitem> <simpara> <!-- not \v, since not supported by PHP --> "\x0B" (<acronym>ASCII</acronym> <literal>11</literal> - (<literal>0x0B</literal>)), a <!-- TODO: -->. + (<literal>0x0B</literal>)), 垂直タブ <!-- TODO: -->. </simpara> </listitem> </itemizedlist> @@ -1797,11 +1983,6 @@ </programlisting> </para> </example> - <note> - <simpara> - 2番目のパラメータは、PHP 4.0.7で追加されました。 - </simpara> - </note> <para> <function>trim</function> および <function>ltrim</function>も 参照下さい。 @@ -1822,9 +2003,7 @@ <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>string - <parameter> - <replaceable><optional>var1</optional></replaceable> - </parameter>... + <parameter><optional>var1</optional></parameter>... </paramdef> </funcprototype> </funcsynopsis> @@ -1837,12 +2016,14 @@ <example> <title><function>sscanf</function> の例</title> <programlisting role="php"> +<![CDATA[ // シリアル番号を得る $serial = sscanf("SN/2350001","SN/%d"); // 続いて製造日を得る $mandate = "January 01 2000"; list($month, $day, $year) = sscanf($mandate,"%s %d %d"); echo "Item $serial was manufactured on: $year-".substr($month,0,3)."-$day\n"; +]]> </programlisting> </example> オプションのパラメータが指定された場合、この関数は、代入された値 @@ -1850,13 +2031,15 @@ <example> <title><function>sscanf</function> - オプションパラメータの使用法</title> <programlisting role="php"> +<![CDATA[ // author 情報を取得し、DocBook エントリを生成 $auth = "24\tLewis Carroll"; -$n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); -echo "<author id='$id'> - <firstname>$first</firstname> - <surname>$last</surname> +$n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); +echo "<author id='$id'> + <firstname>$first</firstname> + <surname>$last</surname> </author>\n"; +]]> </programlisting> </example> </para> @@ -1908,12 +2091,13 @@ </listitem> <listitem> <simpara> - LC_NUMERIC 数字の区切り文字用 + LC_NUMERIC 数字の区切り文字用(<function>localeconv</function> + も参照下さい) </simpara> </listitem> <listitem> <simpara> - LC_TIME 日時。<function>strftime</function> でフォーマットされる + LC_TIME 日時。<function>strftime</function>でフォーマットに使用 </simpara> </listitem> </itemizedlist> @@ -1928,10 +2112,10 @@ 設定は適用されず、単に現在の設定が返されます。 </para> <para> - Setlocale は現在の新しいロケールを返し、ロケール機能が未実装、 + setlocale +は現在の新しいロケールを返し、ロケール機能が未実装、 指定されたロケールが存在しない、カテゴリ名が無効などの場合は - 偽を返します。また、カテゴリ名が無効の場合は警告メッセージが発せ - られます。 + &false; +を返します。また、カテゴリ名が無効の場合は警告メッセージ + が発生します。 </para> </refsect1> </refentry> @@ -1948,24 +2132,23 @@ <funcdef>int <function>similar_text</function></funcdef> <paramdef>string <parameter>first</parameter></paramdef> <paramdef>string <parameter>second</parameter></paramdef> - <paramdef>double - <parameter> - <replaceable><optional>percent</optional></replaceable> - </parameter> + <paramdef>float + <parameter><optional>percent</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> - この関数は、Oliver [1993] に記述されたように二つの文字列の間の - 類似性を見積もります。 - この実装は Oliver の擬似コードの様にスタックを使用せず - プロセス全体の速度が改善されるかどうかにかかわらず - 再帰的コールを行うことに注意して下さい。 - このアルゴリズムの複雑さは、O(N**3) であることにも注意して下さい。 - ただし、N は最も長い文字列の長さです。 + この関数は、Oliver [1993] +に記述されたように二つの文字列の間の類 + 似性を見積もります。この実装は Oliver +の擬似コードの様にスタック + +を使用せずプロセス全体の速度が改善されるかどうかにかかわらず再帰 + +的コールを行うことに注意して下さい。このアルゴリズムの複雑さは、 + O(N**3) であることにも注意して下さい。ただし、N +は最も長い文字列 + の長さです。 </para> <para> - 3番目の引数としてリファレンスを渡すことにより、<function>similar_text</function> は類似性をパーセントで計算します。両方の文字列でマッチした文字の数を返します。 + 3番目の引数としてリファレンスを渡すことにより、 + <function>similar_text</function> は類似性をパーセントで計算しま + す。両方の文字列でマッチした文字の数を返します。 </para> </refsect1> </refentry> @@ -2002,14 +2185,20 @@ <example> <title>soundexの例</title> <programlisting role="php"> +<![CDATA[ soundex ("Euler") == soundex ("Ellery") == 'E460'; soundex ("Gauss") == soundex ("Ghosh") == 'G200'; soundex ("Knuth") == soundex ("Kant") == 'H416'; soundex ("Lloyd") == soundex ("Ladd") == 'L300'; soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222'; +]]> </programlisting> </example> </para> + <para> + <function>levenshtein</function>, <function>metaphone</function>, + <function>similar_text</function>も参照下さい。 + </para> </refsect1> </refentry> @@ -2022,18 +2211,16 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef><function>sprintf</function></funcdef> + <funcdef>string <function>sprintf</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>mixed - <parameter> - <replaceable><optional>args</optional></replaceable> - </parameter>... + <parameter><optional>args</optional></parameter>... </paramdef> </funcprototype> </funcsynopsis> <simpara> - フォーマット文字列<parameter>format</parameter>にしたがって - 生成された文字列を返します。 + +フォーマット文字列<parameter>format</parameter>に基づき生成された + 文字列を返します。 </simpara> <simpara> フォーマット文字列は0個以上のディレクティブ(指示子)により @@ -2136,8 +2323,10 @@ <example> <title>引数の交換</title> <programlisting role="php"> +<![CDATA[ $format = "There are %d monkeys in the %s"; printf($format,$num,$location); +]]> </programlisting> </example> この出力は、"There are 5 monkeys in the tree" のようになります。 @@ -2147,8 +2336,10 @@ <example> <title>引数の交換</title> <programlisting role="php"> +<![CDATA[ $format = "The %s contains %d monkeys"; printf($format,$num,$location); +]]> </programlisting> </example> ここで、問題が発生します。フォーマット文字列における置換指示子の @@ -2159,8 +2350,10 @@ <example> <title>引数の交換</title> <programlisting role="php"> +<![CDATA[ $format = "The %2\$s contains %1\$d monkeys"; printf($format,$num,$location); +]]> </programlisting> </example> 加えて、これによりコードに引数を追加せずに置換指示子を複数回使用 @@ -2168,8 +2361,11 @@ <example> <title>引数の交換</title> <programlisting role="php"> -$format = "The %2\$s contains %1\$d monkeys. That's a nice %2\$s full of %1\$d monkeys."; +<![CDATA[ +$format = "The %2\$s contains %1\$d monkeys. + That's a nice %2\$s full of %1\$d monkeys."; printf($format,$num,$location); +]]> </programlisting> </example> </para> @@ -2186,18 +2382,22 @@ <example> <title>sprintf: 整数を0でパディング</title> <programlisting role="php"> +<![CDATA[ $isodate = sprintf("%04d-%02d-%02d", $year, $month, $day); +]]> </programlisting> </example> <example> <title>sprintf: 通貨をフォーマットする例</title> <programlisting role="php"> +<![CDATA[ $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; // echo $money は "123.1" を出力します。 $formatted = sprintf ("%01.2f", $money); // echo $formatted は "123.10"を出力します +]]> </programlisting> </example> </para> @@ -2268,18 +2468,21 @@ <example> <title><function>strcasecmp</function>の例</title> <programlisting role="php"> +<![CDATA[ $var1 = "Hello"; $var2 = "hello"; if ( !strcasecmp($var1,$var2) ) { echo '$var1 is equal to $var2 in a case-insensitive string comparison'; } +]]> </programlisting> </example> </para> <simpara> <function>ereg</function>, <function>strcmp</function>, <function>substr</function>, <function>stristr</function>, - <function>strstr</function> も参照下さい。 + <function>strncasecmp</function>, <function>strstr</function> も + 参照下さい。 </simpara> </refsect1> </refentry> @@ -2332,8 +2535,9 @@ <simpara> <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strncmp</function>, - <function>strstr</function>も参照下さい。 + <function>stristr</function>, <function>strncasecmp</function>, + <function>strncmp</function>, <function>strstr</function>も参照下 + さい。 </simpara> </refsect1> </refentry> @@ -2361,10 +2565,9 @@ POSIXの場合、この関数は <function>strcmp</function> と等価です。 </simpara> <simpara> - この比較は大文字小文字を区別すること、そして、 - <function>strcmp</function>とはことなり、バイナリには使用できない - ことに注意して下さい。 + +<function>strcmp</function>とは異なり、バイナリには使用できないこ + とに注意して下さい。 </simpara> <note> <simpara> @@ -2419,18 +2622,15 @@ <funcdef>string <function>strip_tags</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string - <parameter> - <replaceable><optional>allowable_tags</optional></replaceable> - </parameter> + <parameter><optional>allowable_tags</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> - この関数は、指定した文字列から全ての HTML および PHP タグを - 取り除きます。 - 不完全あるいは間違ったタグの場合は、エラーとなり警告を発生します。 - この関数は、<function>fgetss</function> 関数と同じタグ除去アルゴリズム - を使用します。 + +この関数は、指定した文字列から全てのHTMLおよびPHPタグを取り除きま + +す。不完全あるいは間違ったタグの場合は、エラーとなり警告を発生し + ます。この関数は、<function>fgetss</function> +関数と同じタグ除去 + アルゴリズムを使用します。 </simpara> <para> オプションの2番目の引数により、取り除かないタグを指定gきます。 @@ -2441,6 +2641,25 @@ </para> </note> </para> + <para> + <example> + <title><function>strip_tags</function>の例</title> + <programlisting role="php"> +<![CDATA[ +$string = strip_tags($string, '<a><b><i><u>'); +]]> + </programlisting> + </example> + </para> + <warning> + <para> + この関数は、<parameter>allowable_tags</parameter>で許可したタグ + の属性を全く修整しません。これには、<literal>style</literal> +お + よび <literal>onmouseover</literal>属性が含まれており、悪意のあ + +るユーザが他のユーザに見せるようなテキストを投稿する際に危険な行 + 為を行う可能性があります。 + </para> + </warning> </refsect1> </refentry> @@ -2580,7 +2799,8 @@ h言われます。このアルゴリズムと(<function>strcmp</function>を使 用した)通常のコンピュータ文字列ソートの間の違いの例を次に示します。 <informalexample> - <programlisting role="php"> + <programlisting> +<![CDATA[ $arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png"); echo "Standard string comparison\n"; usort($arr1,"strcmp"); @@ -2588,29 +2808,32 @@ echo "\nNatural order string comparison\n"; usort($arr2,"strnatcmp"); print_r($arr2); +]]> </programlisting> </informalexample> 上の例は、以下の出力を生成します。 <informalexample> - <programlisting> + <screen> +<![CDATA[ Standard string comparison Array ( - [0] => img1.png - [1] => img10.png - [2] => img12.png - [3] => img2.png + [0] => img1.png + [1] => img10.png + [2] => img12.png + [3] => img2.png ) Natural order string comparison Array ( - [0] => img1.png - [1] => img2.png - [2] => img10.png - [3] => img12.png + [0] => img1.png + [1] => img2.png + [2] => img10.png + [3] => img12.png ) - </programlisting> +]]> + </screen> </informalexample> 詳細な情報については、Martin Poolの <ulink url="&url.strnatcmp;">自然順文字列比較</ulink>のページを参 @@ -2630,8 +2853,10 @@ <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strcmp</function>, - <function>strncmp</function>, <function>strnatcasecmp</function>, - <function>strstr</function>も参照下さい。 + <function>strncmp</function>, <function>strncasecmp</function>, + <function>strnatcasecmp</function>, <function>strstr</function>, + <function>natsort</function>, <function>natcasesort</function> + も参照下さい。 </simpara> </refsect1> </refentry> @@ -2671,9 +2896,9 @@ <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strcmp</function>, - <function>strncmp</function>, <function>strnatcmp</function>, - <function>strstr</function>, <function>natsort</function>, - <function>natcasesort</function> も参照下さい。 + <function>strncmp</function>, <function>strncasecmp</function>, + <function>strnatcmp</function>, <function>strstr</function> + も参照下さい。 </simpara> </refsect1> </refentry> @@ -2732,14 +2957,10 @@ <paramdef>string <parameter>input</parameter></paramdef> <paramdef>int <parameter>pad_length</parameter></paramdef> <paramdef>string - <parameter> - <replaceable><optional>pad_string</optional></replaceable> - </parameter> + <parameter><optional>pad_string</optional></parameter> </paramdef> <paramdef>int - <parameter> - <replaceable><optional>pad_type</optional></replaceable> - </parameter> + <parameter><optional>pad_type</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> @@ -2764,10 +2985,12 @@ <example> <title><function>str_pad</function>の例</title> <programlisting role="php"> +<![CDATA[ $input = "Alien"; print str_pad($input, 10); // "Alien "を出力 print str_pad($input, 10, "-=", STR_PAD_LEFT); // "-=-=-Alien"を出力 print str_pad($input, 10, "_", STR_PAD_BOTH); // "__Alien___"を出力 +]]> </programlisting> </example> </para> @@ -2810,6 +3033,7 @@ は混同しやすいです。これらを区別するには、次のようにします。 <informalexample> <programlisting role="php"> +<![CDATA[ // PHP 4.0b3以降の場合: $pos = strpos ($mystring, "b"); if ($pos === false) { // 注意: 等号が3つです。 @@ -2821,6 +3045,7 @@ if (is_string ($pos) && !$pos) { // 見つかりませんでした... } +]]> </programlisting> </informalexample> </para> @@ -2879,12 +3104,14 @@ <example> <title><function>strrchr</function>の例</title> <programlisting role="php"> +<![CDATA[ // $PATH 中の最後のディレクトリを取得 $dir = substr( strrchr( $PATH, ":" ), 1 ); // 最後の改行文字以降をすべて取得 $text = "Line 1\nLine 2\nLine 3"; $last = substr (strrchr ($text, 10), 1 ); +]]> </programlisting> </example> </para> @@ -2918,7 +3145,9 @@ <example> <title><function>str_repeat</function>の例</title> <programlisting role="php"> +<![CDATA[ echo str_repeat("-=", 10); +]]> </programlisting> </example> <para> @@ -2947,6 +3176,16 @@ </funcsynopsis> <para> <parameter>string</parameter>を逆順にして返します。 + <example> + <title><function>strrev</function>で文字列を逆順にする</title> + <programlisting role="php"> +<![CDATA[ +<php +echo strrev("Hello world!"); // "!dlrow olleH"を出力 +?> +]]> + </programlisting> + </example> </para> </refsect1> </refentry> @@ -2977,6 +3216,29 @@ </para> <para> <parameter>needle</parameter>が見つからないと&false;を返します。 + <note> + <para> + +"位置0に文字が見つかった"と"文字が見つからなかった"場合の返り値 + +は混同しやすいです。この違いを見分ける方法を以下に示します。 + <informalexample> + <programlisting role="php"> +<![CDATA[ +// PHP 4.0b3以降の場合: +$pos = strrpos($mystring, "b"); +if ($pos === false) { // 注意: 等号が3つ + // 見つからない... +} + +// 4.0b3より前のバージョンの場合: +$pos = strrpos($mystring, "b"); +if (is_string($pos) && !$pos) { + // 見つからない... +} +]]> + </programlisting> + </informalexample> + </para> + </note> </para> <para> <parameter>needle</parameter>が文字列でない場合は数値に @@ -3014,7 +3276,9 @@ <para> <informalexample> <programlisting role="php"> +<![CDATA[ $var = strspn ("42 is the answer, what is the question ...", "1234567890"); +]]> </programlisting> </informalexample> このコードは、<varname>$var</varname>に2を代入します。これは、 @@ -3042,7 +3306,7 @@ </funcsynopsis> <para> <parameter>haystack</parameter>の中で<parameter>needle</parameter>が - 最初に現れる場所??、文字列の終わりまでを返します。 + 最初に現れる場所から文字列の終わりまでを返します。 </para> <para> <parameter>needle</parameter> が見つからない場合は&false;を返しま @@ -3065,16 +3329,19 @@ <example> <title><function>strstr</function>の例</title> <programlisting role="php"> +<![CDATA[ $email = '[EMAIL PROTECTED]'; $domain = strstr ($email, '@'); print $domain; // designmultimedia.comを出力する +]]> </programlisting> </example> </para> <para> + <function>ereg</function>, <function>preg_match</function>, <function>strchr</function>, <function>stristr</function>, - <function>strrchr</function>, <function>substr</function>, - <function>ereg</function>も参照下さい。 + <function>strpos</function>, <function>strrchr</function>, + <function>substr</function>も参照下さい。 </para> </refsect1> </refentry> @@ -3101,12 +3368,14 @@ <example> <title><function>strtok</function>の例</title> <programlisting role="php"> +<![CDATA[ $string = "This is an example string"; $tok = strtok($string," "); while($tok) { - echo "Word=$tok<br>"; + echo "Word=$tok<br>"; $tok = strtok(" "); } +]]> </programlisting> </example> </para> @@ -3116,7 +3385,42 @@ 2回目以降のコールではトークンのみを必要とします。 最初からやりなおす場合や新しい文字列をトークンに分割する場合、 初期化するために再度string引数を指定してstrtokをコールします。 - 文字列は、引数の文字のどれかが見つかった場扣gトークンに分割されます。 + +文字列は、引数の文字のどれかが見つかったはトークンに分割されます。 + </para> + <para> + 空の部分が見つかった場合の動作はPHP +4.1.0で変更されました。古い動 + +作は、空の文字列を返しますが、新しい、正しい動作は、文字列のその + 部分を単に飛ばします。 + <example> + <title>古い<function>strtok</function>の動作</title> + <programlisting role="php"> +<![CDATA[ + $first_token = strtok('/something', '/'); + $second_token = strtok('/'); + var_dump ($first_token, $second_token); + +/* 出力: + string(0) "" + string(9) "something" +*/ +]]> + </programlisting> + </example> + <example> + <title>新しい<function>strtok</function>の動作</title> + <programlisting role="php"> +<![CDATA[ + $first_token = strtok('/something', '/'); + $second_token = strtok('/'); + var_dump ($first_token, $second_token); + +/* 出力: + string(9) "something" + bool(false) +*/ +]]> + </programlisting> + </example> </para> <para> トークンを"0"にすることもできることにも注意して下さい。 @@ -3154,14 +3458,16 @@ <example> <title><function>strtolower</function>の例</title> <programlisting role="php"> +<![CDATA[ $str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtolower($str); print $str; # 「mary had a little lamb and she loved it so」を出力します。 +]]> </programlisting> </example> <para> - <function>strtoupper</function> および - <function>ucfirst</function> も参照下さい。 + <function>strtoupper</function>, <function>ucfirst</function>, + <function>ucwords</function>も参照下さい。 </para> </refsect1> </refentry> @@ -3186,20 +3492,21 @@ <para> 「アルファベット部分」は現在のロケールにより決定されます。 つまり、たとえばデフォルトの "C" ロケールである場合は、 - ウムラウトa (訳注:日本語文字セットでは表示できない文字のため省略) - のような文字は変換されません。 + ウムラウトa (ä)のような文字は変換されません。 </para> <example> <title><function>strtoupper</function>の例</title> <programlisting role="php"> +<![CDATA[ $str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtoupper ($str); print $str; # 「MARY HAD A LITTLE LAMB AND SHE LOVED IT SO」を出力します。 +]]> </programlisting> </example> <para> - <function>strtolower</function> および - <function>ucfirst</function> も参照下さい。 + <function>strtolower</function>, <function>ucfirst</function>, + <function>ucwords</function> も参照下さい。 </para> </refsect1> </refentry> @@ -3254,7 +3561,9 @@ <example> <title><function>str_replace</function>の例</title> <programlisting role="php"> -$bodytag = str_replace ("%body%", "black", "<body text=%body%>"); +<![CDATA[ +$bodytag = str_replace ("%body%", "black", "<body text=%body%>"); +]]> </programlisting> </example> </para> @@ -3300,7 +3609,9 @@ <example> <title><function>strtr</function>の例</title> <programlisting role="php"> - $addr = strtr($addr, "aao", "aao"); // 訳注:日本語文字セットにおける非表示文字を変換 +<![CDATA[ +$addr = strtr($addr, " ", "aao"); +]]> </programlisting> </example> </para> @@ -3316,15 +3627,17 @@ 例: <informalexample> <programlisting role="php"> -$trans = array ("hello" => "hi", "hi" => "hello"); +<![CDATA[ +$trans = array ("hello" => "hi", "hi" => "hello"); echo strtr("hi all, I said hello", $trans) . "\n"; +]]> </programlisting> </informalexample> この例では次のように表示されます。: "hello all, I said hi", </para> <note> <simpara> - この機能 (2つの引数) は、PHP 4.0 で追加されました。 + この機能 (2番目の引数) は、PHP 4.0 で追加されました。 </simpara> </note> <para> @@ -3370,48 +3683,55 @@ 例: <informalexample> <programlisting role="php"> -$rest = substr("abcdef", 1); // "bcdef" を返します -$rest = substr("abcdef", 1, 3); // "bcd" を返します +<![CDATA[ +$rest = substr("abcdef", 1); // "bcdef"を返します +$rest = substr("abcdef", 1, 3); // "bcd"を返します +$rest = substr("abcdef", 0, 4); // "abcd"を返します +$rest = substr("abcdef", 0, 8); // "abcdef"を返します +]]> </programlisting> </informalexample> </para> <para> <parameter>start</parameter> が負の場合、返される文字列は、 - <parameter>string</parameter> の 後ろから数えて<parameter> - start</parameter>番目から始まる文字列となります。 - 例: - <informalexample> - <programlisting role="php"> + <parameter>string</parameter>の後ろから数えて + <parameter>start</parameter>番目から始まる文字列となります。 + </para> + <example> + <title>負の<parameter>start</parameter>を使用</title> + <programlisting role="php"> +<![CDATA[ $rest = substr("abcdef", -1); // "f" を返します $rest = substr("abcdef", -2); // "ef" を返します $rest = substr("abcdef", -3, 1); // "d" を返します - </programlisting> - </informalexample> - </para> +]]> + </programlisting> + </example> <para> - <parameter>length</parameter> が指定され、かつ正である - 場合、返される文字列は <parameter>start</parameter> から - ?えて <parameter>length</parameter> 文字数分となります。 - 負の length が指定された場合、(start は文字列の終端を過ぎているので) - 返される文字列は <parameter>start</parameter> の位置にある - 1文字のみとなります。 + <parameter>length</parameter> が指定され、かつ正である場合、返さ + れる文字列は <parameter>start</parameter> から数えて + <parameter>length</parameter>文字数分となります。負の length が指 + 定された場合、(start +は文字列の終端を過ぎているので)返される文字 + 列は <parameter>start</parameter> +の位置にある1文字のみとなります。 </para> <para> - <parameter>length</parameter> が指定され、かつ負である - 場合、返される文字列は <parameter>start</parameter> の後ろ - から数えて <parameter>length</parameter> 文字までとなります。 - この指定により切り出す文字列の長さが負となる場合、 - <parameter>start</parameter>の位置にある1文字のみが - 文字列として返されます。 - </para> - <para> - 例: - <informalexample> - <programlisting role="php"> -$rest = substr("abcdef", 1, -1); // "bcde" を返Wます - </programlisting> - </informalexample> + <parameter>length</parameter> が指定され、かつ負である場合、返さ + れる文字列は <parameter>start</parameter> の後ろから数えて + <parameter>length</parameter> 文字までとなります。この指定により + +切り出す文字列の長さが負となる場合、<parameter>start</parameter> + の位置にある1文字のみが文字列として返されます。 </para> + <example> + <title>負の<parameter>length</parameter>を使用</title> + <programlisting role="php"> +<![CDATA[ +$rest = substr("abcdef", 0, -1); // "abcde"を返す +$rest = substr("abcdef", 2, -1); // "cde"を返す +$rest = substr("abcdef", 4, -4); // ""を返す +$rest = substr("abcdef", -3, -1); // "de"を返す +]]> + </programlisting> + </example> <para> <function>strrchr</function> および <function>ereg</function> も参照下さい。 @@ -3442,7 +3762,9 @@ <example> <title><function>substr_count</function>の例</title> <programlisting> +<![CDATA[ print substr_count("This is a test", "is"); // 2を出力する +]]> </programlisting> </example> </para> @@ -3498,24 +3820,26 @@ <example> <title><function>substr_replace</function>の例</title> <programlisting role="php"> -<?php +<![CDATA[ +<?php $var = 'ABCDEFGH:/MNRPQR/'; -echo "Original: $var<hr>\n"; - -/* 以下の2つの例は、全ての $var で 'bob' で置曣Wます。 */ -echo substr_replace ($var, 'bob', 0) . "<br>\n"; -echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; +echo "Original: $var<hr>\n"; +/* 以下の2つの例は、全ての $var で 'bob' で置換します。 */ +echo substr_replace ($var, 'bob', 0) . "<br>\n"; +echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; + /* $var の先頭に 'bob' を挿入します */ -echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; +echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; /* 次の2つの例は、$var の 'MNRPQR' を 'bob'で置換します */ -echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; -echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; +echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; +echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; /* $var から 'MNRPQR' を削除します */ -echo substr_replace ($var, '', 10, -1) . "<br>\n"; -?> +echo substr_replace ($var, '', 10, -1) . "<br>\n"; +?> +]]> </programlisting> </example> </para> @@ -3550,6 +3874,11 @@ </paramdef> </funcprototype> </funcsynopsis> + <note> + <simpara> + 2番目のパラメータは、PHP 4.1.0で追加されました。 + </simpara> + </note> <para> この関数は文字列の最初および最後から空白文字を取り除き、 取り除かれた文字列を返します。2番目のパラメータを指定しない場合、 @@ -3620,11 +3949,6 @@ </programlisting> </para> </example> - <note> - <simpara> - 2番目のパラメータは、PHP 4.0.7で追加されました。 - </simpara> - </note> <para> <function>ltrim</function> および <function>rtrim</function>も 参照下さい。 @@ -3635,9 +3959,7 @@ <refentry id="function.ucfirst"> <refnamediv> <refname>ucfirst</refname> - <refpurpose> - 文字列の最初の文字を大文字にする - </refpurpose> + <refpurpose>文字列の最初の文字を大文字にする</refpurpose> </refnamediv> <refsect1> <title>説明</title> @@ -3657,16 +3979,21 @@ (ä)は変換されません。 <example> <title><function>ucfirst</function>の例</title> - <programlisting role="php"> -$text = 'mary had a little lamb and she loved it so.'; -$text = ucfirst ($text); // $textは、「Mary had a little lamb and - // she loved it so」になります。 + <programlisting role="php"> +<![CDATA[ +$foo = 'hello world!'; +$foo = ucfirst($foo); // Hello world! + +$bar = 'HELLO WORLD!'; +$bar = ucfirst($bar); // HELLO WORLD! +$bar = ucfirst(strtolower($bar)); // Hello world! +]]> </programlisting> </example> </para> <para> - <function>strtoupper</function>および - <function>strtolower</function>も参照下さい。 + <function>strtoupper</function>, <function>strtolower</function>, + <function>ucwords</function>も参照下さい。 </para> </refsect1> </refentry> @@ -3692,9 +4019,14 @@ <example> <title><function>ucwords</function>の例</title> <programlisting role="php"> -$text = "mary had a little lamb and she loved it so."; -$text = ucwords($text); // $textは「Mary Had A Little Lamb - // And She Loved It So」になります。 +<![CDATA[ +$foo = 'hello world!'; +$foo = ucwords($foo); // Hello World! + +$bar = 'HELLO WORLD!'; +$bar = ucwords($bar); // HELLO WORLD! +$bar = ucwords(strtolower($bar)); // Hello World! +]]> </programlisting> </example> <note> @@ -3712,6 +4044,70 @@ </refsect1> </refentry> + <refentry id="function.vprintf"> + <refnamediv> + <refname>vprintf</refname> + <refpurpose>フォーマットされた文字列を出力する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>vprintf</function></funcdef> + <paramdef>string <parameter>format</parameter></paramdef> + <paramdef>array + <parameter>args</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + +<parameter>format</parameter>に基づき文字列フォーマットされた文字 + +列を出力します。(フォーマットは<function>sprintf</function>のドキュ + メントに既述されています。) + </simpara> + <simpara> + +<function>printf</function>と動作は同じですが、可変長の引数ではな + く、配列を引数として受け取ります。 + </simpara> + <simpara> + <function>printf</function>, <function>sprintf</function>, + <function>vsprintf</function> も参照下さい。 + </simpara> + </refsect1> + </refentry> + + <refentry id="function.vsprintf"> + <refnamediv> + <refname>vsprintf</refname> + <refpurpose>フォーマットされた文字列を返す</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>vsprintf</function></funcdef> + <paramdef>string <parameter>format</parameter></paramdef> + <paramdef>array + <parameter>args</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + (<function>sprintf</function>のドキュメントに記述された) + +<parameter>format</parameter>に基づきフォーマットされた文字列とし + て配列値を返します。 + </simpara> + <simpara> + <function>sprintf</function>と動作は同じですが、 +可変長の引数では + なく配列を引数とします。 + </simpara> + <simpara> + <function>sprintf</function>, <function>vsprintf</function>, + <function>vprintf</function> も参照下さい。 + </simpara> + </refsect1> + </refentry> + <refentry id="function.wordwrap"> <refnamediv> <refname>wordwrap</refname> @@ -3762,10 +4158,12 @@ <example> <title><function>wordwrap</function>例</title> <programlisting role="php"> +<![CDATA[ $text = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap( $text, 20 ); echo "$newtext\n"; +]]> </programlisting> </example> </para> @@ -3774,20 +4172,24 @@ </para> <para> <informalexample> - <programlisting> + <screen> +<![CDATA[ The quick brown fox jumped over the lazy dog. - </programlisting> +]]> + </screen> </informalexample> </para> <para> <example> <title><function>wordwrap</function> の例</title> <programlisting role="php"> +<![CDATA[ $text = "A very long woooooooooooord."; $newtext = wordwrap( $text, 8, "\n", 1); echo "$newtext\n"; +]]> </programlisting> </example> </para> @@ -3797,15 +4199,38 @@ <para> <informalexample> <programlisting> +<![CDATA[ A very long wooooooo ooooord. +]]> </programlisting> </informalexample> </para> <para> <function>nl2br</function>も参照下さい。 + </para> + </refsect1> + </refentry> + + <refentry id='function.nl-langinfo'> + <refnamediv> + <refname>nl_langinfo</refname> + <refpurpose> + 言語及びロケール情報を検索する + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>nl_langinfo</function></funcdef> + <paramdef>int <parameter>item</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + &warn.undocumented.func; </para> </refsect1> </refentry>