cvs: phpdoc-ja /reference/funchand reference.xml /reference/funchand/functions call-user-func-array.xml call-user-func.xml create-function.xml
func-get-arg.xml func-get-args.xml func-num-args.xml function-exists.xml get-defined-functions.xml register-shutdown-function.xml
register-tick-function.xml unregister-tick-function.xml

From: Date: Mon, 15 Aug 2005 16:11:33 +0000
Subject: cvs: phpdoc-ja /reference/funchand reference.xml /reference/funchand/functions call-user-func-array.xml call-user-func.xml create-function.xml
func-get-arg.xml func-get-args.xml func-num-args.xml function-exists.xml get-defined-functions.xml register-shutdown-function.xml
register-tick-function.xml unregister-tick-function.xml
Groups: php.doc.ja 
Request: Send a blank email to doc-ja+get-1127@lists.php.net to get a copy of this message
takagi Mon Aug 15 12:11:33 2005 EDT Modified files: /phpdoc-ja/reference/funchand/functions unregister-tick-function.xml register-tick-function.xml register-shutdown-function.xml get-defined-functions.xml function-exists.xml func-num-args.xml func-get-args.xml func-get-arg.xml create-function.xml call-user-func.xml call-user-func-array.xml /phpdoc-ja/reference/funchand reference.xml Log: sync with en.

http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/unregister-tick-function.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-ja/reference/funchand/functions/unregister-tick-function.xml diff -u phpdoc-ja/reference/funchand/functions/unregister-tick-function.xml:1.3 phpdoc-ja/reference/funchand/functions/unregister-tick-function.xml:1.4 --- phpdoc-ja/reference/funchand/functions/unregister-tick-function.xml:1.3 Mon Nov 22 23:45:34 2004 +++ phpdoc-ja/reference/funchand/functions/unregister-tick-function.xml Mon Aug 15 12:11:30 2005 @@ -1,26 +1,26 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./ja/functions/funchand.xml, last change in rev 1.7 --> -<!-- EN-Revision: 1.12 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: 1.4 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.unregister-tick-function"> <refnamediv> <refname>unregister_tick_function</refname> <refpurpose> - 各tickの実行用の関数の登録を解除する + 各 tick の実行用の関数の登録を解除する </refpurpose> </refnamediv> <refsect1> <title>説明</title> <methodsynopsis> <type>void</type><methodname>unregister_tick_function</methodname> - <methodparam><type>string</type><parameter>func</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>arg</parameter></methodparam> + <methodparam><type>string</type><parameter>function_name</parameter></methodparam> </methodsynopsis> <simpara> <parameter>func</parameter> という名前の関数の登録を解除します。 これにより、<link - linkend="control-structures.declare">tick</link>がコールされた場 - 合でもこの関数は実行されなくなります。 - </simpara> + linkend="control-structures.declare">tick</link> がコールされた + 場合でもこの関数は実行されなくなります。</simpara> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/register-tick-function.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-ja/reference/funchand/functions/register-tick-function.xml diff -u phpdoc-ja/reference/funchand/functions/register-tick-function.xml:1.3 phpdoc-ja/reference/funchand/functions/register-tick-function.xml:1.4 --- phpdoc-ja/reference/funchand/functions/register-tick-function.xml:1.3 Mon Nov 22 23:45:34 2004 +++ phpdoc-ja/reference/funchand/functions/register-tick-function.xml Mon Aug 15 12:11:30 2005 @@ -1,25 +1,50 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./ja/functions/funchand.xml, last change in rev 1.7 --> -<!-- EN-Revision: 1.12 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: 1.9 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.register-tick-function"> <refnamediv> <refname>register_tick_function</refname> <refpurpose> - 各tickで実行する関数を登録する + 各 tick で実行する関数を登録する </refpurpose> </refnamediv> <refsect1> <title>説明</title> <methodsynopsis> - <type>void</type><methodname>register_tick_function</methodname> - <methodparam><type>string</type><parameter>func</parameter></methodparam> + <type>bool</type><methodname>register_tick_function</methodname> + <methodparam><type>callback</type><parameter>function</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter>arg</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> </methodsynopsis> <simpara> - <link linkend="control-structures.declare">tick</link>がコールさ - れた際に実行される<parameter>func</parameter>という名前の関数を登 - 録します。 + <link linkend="control-structures.declare">tick</link> がコール + された際に実行される <parameter>func</parameter> という名前の関数を + 登録します。また、 <parameter>func</parameter> にはオブジェクトと + メソッドの配列を渡すことも可能です。 </simpara> + <para> + <example> + <title><function>register_tick_function</function> の例</title> + <programlisting role="php"> +<![CDATA[ +<?php +// 関数をコールバックとして使用する +register_tick_function('my_function', true); + +// オブジェクトのメソッドを使用する +$object = new my_class(); +register_tick_function(array(&$object, 'my_method'), true); +?> +]]> + </programlisting> + </example> + </para> + <para> + <function>declare</function> + および <function>unregister_tick_function</function> も参照ください。 + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/register-shutdown-function.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-ja/reference/funchand/functions/register-shutdown-function.xml diff -u phpdoc-ja/reference/funchand/functions/register-shutdown-function.xml:1.3 phpdoc-ja/reference/funchand/functions/register-shutdown-function.xml:1.4 --- phpdoc-ja/reference/funchand/functions/register-shutdown-function.xml:1.3 Mon Nov 22 23:45:34 2004 +++ phpdoc-ja/reference/funchand/functions/register-shutdown-function.xml Mon Aug 15 12:11:30 2005 @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./ja/functions/funchand.xml, last change in rev 1.1 --> -<!-- EN-Revision: 1.1 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: 1.12 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.register-shutdown-function"> <refnamediv> <refname>register_shutdown_function</refname> @@ -9,20 +11,70 @@ <refsect1> <title>説明</title> <methodsynopsis> - <type>int</type><methodname>register_shutdown_function</methodname> - <methodparam><type>string</type><parameter>func</parameter></methodparam> + <type>void</type><methodname>register_shutdown_function</methodname> + <methodparam><type>callback</type><parameter>function</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> </methodsynopsis> <simpara> スクリプト処理が完了した際に実行される <parameter>func</parameter> という名前の関数を登録します。 </simpara> <para> - 陥りやすいミス: + <function>register_shutdown_function</function> は複数回コールする + ことが可能で、登録された順に関数がコールされます。 + 登録した関数内で <function>exit</function> をコールした場合、 + 処理はそこで終了してその他のシャットダウン関数はコールされません。 + </para> + <para> + PHP 4.0.6 以前のバージョンを Apache で動かしている場合、 + 登録されたシャットダウン関数はリクエストの完了後(結果の + 出力を含む)に実行されます。そのため、<function>echo</function> + や <function>print</function> を用いてブラウザに出力したり + <function>ob_get_contents</function> を用いて出力バッファの内容を + 取得したりすることができませんでした。 + PHP 4.1 以降、シャットダウン関数はリクエストの一部として実行される + ようになり、そこから結果を出力できるようになりました。現在のところ、 + シャットダウン関数の中で出力バッファリング関数を用いてデータを + 加工する方法はありません。 + シャットダウン関数はすべての出力バッファを閉じてからコールされます。 + そのため、たとえ <link + linkend="ini.zlib.output-compression">zlib.output_compression</link> + が有効になっていたとしても出力結果は圧縮されません。 + </para> + <para> + PHP 4 以降、<function>register_shutdown_function</function> に + 追加のパラメータを渡すことでシャットダウン関数にパラメータを + 渡せるようになりました。 + </para> + <note> + <para> + 一般に、PHP では未定義の関数は致命的なエラーを引き起こします。 + しかし <function>register_shutdown_function</function> で指定された + <parameter>function</parameter> が未定義の場合はそのかわりに + <constant>E_WARNING</constant> レベルのエラーが発生します。 + また、PHP の内部的な理由により、このエラーは + <function>Unknown</function> の #0 行目で発生したとみなされます。 + </para> + </note> + <note> + <para> + Apache などいくつかの Web サーバでは、スクリプトの実行時ディレクトリを + シャットダウン関数内で変更可能です。 + </para> + </note> + <note> + <para> + シャットダウン関数はスクリプトがシャットダウンする際にコールされるので、 + その際は常にヘッダが送信されています。 + </para> + </note> + <para> + <link linkend="ini.auto-append-file">auto_append_file</link>, + <function>exit</function>, および + <link linkend="features.connection-handling">接続処理</link> + の章も参照ください。 </para> - <simpara> - この関数ではブラウザへの出力は許可されないので、 - printまたはechoのような文を使用してデバッグを行うことはできません。 - </simpara> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/get-defined-functions.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-ja/reference/funchand/functions/get-defined-functions.xml diff -u phpdoc-ja/reference/funchand/functions/get-defined-functions.xml:1.4 phpdoc-ja/reference/funchand/functions/get-defined-functions.xml:1.5 --- phpdoc-ja/reference/funchand/functions/get-defined-functions.xml:1.4 Sun Jan 2 02:23:32 2005 +++ phpdoc-ja/reference/funchand/functions/get-defined-functions.xml Mon Aug 15 12:11:30 2005 @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./ja/functions/funchand.xml, last change in rev 1.6 --> -<!-- EN-Revision: 1.6 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: 1.5 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.get-defined-functions"> <refnamediv> <refname>get_defined_functions</refname> @@ -12,7 +14,7 @@ <title>説明</title> <methodsynopsis> <type>array</type><methodname>get_defined_functions</methodname> - <methodparam><type>void</type><parameter/></methodparam> + <void/> </methodsynopsis> <para> この関数は、組込(内部)関数およびユーザ定義関数を共に含む定義済み @@ -20,49 +22,58 @@ <varname>$arr["internal"]</varname>、ユーザ定義関数は <varname>$arr["user"]</varname> によりアクセス可能となります。(以 下の例を参照) + </para> + <para> <informalexample> <programlisting role="php"> -function myrow($id, $data) { - return "&lt;tr&gt;&lt;th&gt;$id&lt;/th&gt;&lt;td&gt;$data&lt;/td&gt;&lt;/tr&gt;\n"; +<![CDATA[ +<?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> +?> +]]> + </programlisting> + <para> + この例の出力は、以下のようになります。 + </para> + <screen> +<![CDATA[ Array ( - [internal] =&gt; Array + [internal] => Array ( - [0] =&gt; zend_version - [1] =&gt; func_num_args - [2] =&gt; func_get_arg - [3] =&gt; func_get_args - [4] =&gt; strlen - [5] =&gt; strcmp - [6] =&gt; strncmp + [0] => zend_version + [1] => func_num_args + [2] => func_get_arg + [3] => func_get_args + [4] => strlen + [5] => strcmp + [6] => strncmp ... - [750] =&gt; bcscale - [751] =&gt; bccomp + [750] => bcscale + [751] => bccomp ) - [user] =&gt; Array + [user] => Array ( - [0] =&gt; myrow + [0] => myrow ) ) - </programlisting> +]]> + </screen> </informalexample> </para> <para> - <function>get_defined_vars</function>も参照ください。 + <function>function_exists</function>, + <function>get_defined_vars</function> + および <function>get_defined_constants</function> も参照ください。 </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/function-exists.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-ja/reference/funchand/functions/function-exists.xml diff -u phpdoc-ja/reference/funchand/functions/function-exists.xml:1.4 phpdoc-ja/reference/funchand/functions/function-exists.xml:1.5 --- phpdoc-ja/reference/funchand/functions/function-exists.xml:1.4 Sun Jan 2 02:23:32 2005 +++ phpdoc-ja/reference/funchand/functions/function-exists.xml Mon Aug 15 12:11:31 2005 @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./ja/functions/funchand.xml, last change in rev 1.1 --> -<!-- EN-Revision: 1.1 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: 1.3 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.function-exists"> <refnamediv> <refname>function_exists</refname> @@ -15,18 +17,26 @@ <methodparam><type>string</type><parameter>function_name</parameter></methodparam> </methodsynopsis> <para> - <parameter>function_name</parameter> について定義された関数のリス - トを確認します。指定した関数名がある場合に&true;、他の場合に&false;を + <parameter>function_name</parameter> について定義された関数のリストを + 確認します。指定した関数名がある場合に&true;、他の場合に&false;を 返します。 + </para> + <para> <informalexample> <programlisting role="php"> +<![CDATA[ +<?php if (function_exists('imap_open')) { - echo "IMAP 関数が利用可能です。&lt;br&gt;\n"; + echo "IMAP 関数が利用可能です。<br />\n"; } else { - echo "IMAP 関数は利用できません。&lt;br&gt;\n"; + echo "IMAP 関数は利用できません。<br />\n"; } +?> +]]> </programlisting> </informalexample> + </para> + <para> ある関数がそれ自体設定やコンパイルオプションの問題で使用できない 場合でもその関数の名前が存在する可能性があることに注意してください。 </para> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/func-num-args.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-ja/reference/funchand/functions/func-num-args.xml diff -u phpdoc-ja/reference/funchand/functions/func-num-args.xml:1.3 phpdoc-ja/reference/funchand/functions/func-num-args.xml:1.4 --- phpdoc-ja/reference/funchand/functions/func-num-args.xml:1.3 Mon Nov 22 23:45:34 2004 +++ phpdoc-ja/reference/funchand/functions/func-num-args.xml Mon Aug 15 12:11:31 2005 @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./ja/functions/funchand.xml, last change in rev 1.1 --> -<!-- EN-Revision: 1.1 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: 1.7 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.func-num-args"> <refnamediv> <refname>func_num_args</refname> @@ -16,18 +18,26 @@ カレントのユーザ定義関数に渡された引数の数を返します。 <function>func_num_args</function>は関数定義部以外でコールされた 場合に警告を発生します。 + この関数を、直接他の関数のパラメータとして使用することはできません。 + その代わりに、いったん結果を変数に格納し、それを関数に渡します。 </simpara> + + &note.funcnoparam; + <para> <informalexample> <programlisting role="php"> -&lt;?php -function foo() { +<![CDATA[ +<?php +function foo() +{ $numargs = func_num_args(); echo "Number of arguments: $numargs\n"; } -foo( 1, 2, 3 ); // 'Number of arguments: 3'を出力します。 -?&gt; +foo(1, 2, 3 ); // 'Number of arguments: 3'を出力します。 +?> +]]> </programlisting> </informalexample> </para> @@ -36,11 +46,6 @@ および<function>func_get_args</function>と組み合わせて使用され、 ユーザ定義関数において可変長の引数リストを使用することができるようになります。 </simpara> - <note> - <simpara> - この関数はPHP4で追加されました。 - </simpara> - </note> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/func-get-args.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-ja/reference/funchand/functions/func-get-args.xml diff -u phpdoc-ja/reference/funchand/functions/func-get-args.xml:1.4 phpdoc-ja/reference/funchand/functions/func-get-args.xml:1.5 --- phpdoc-ja/reference/funchand/functions/func-get-args.xml:1.4 Mon Nov 22 23:45:34 2004 +++ phpdoc-ja/reference/funchand/functions/func-get-args.xml Mon Aug 15 12:11:31 2005 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.4 $ --> -<!-- EN-Revision: 1.4 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.5 $ --> +<!-- EN-Revision: 1.10 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.func-get-args"> <refnamediv> <refname>func_get_args</refname> @@ -13,11 +14,22 @@ <void/> </methodsynopsis> <simpara> - 各要素がカレントのユーザ定義関数の引数リストの各メンバーに対応する配列を - 返します。 - <function>func_get_args</function>は関数定義部以外でコールされた + 各要素がカレントのユーザ定義関数の引数リスト中の各メンバーのコピーに + 対応する配列を返します。 + <function>func_get_args</function> は関数定義部以外でコールされた 場合に警告を発生します。 + この関数を、直接他の関数のパラメータとして使用することはできません。 + その代わりに、いったん結果を変数に格納し、それを関数に渡します。 </simpara> + <note> + <simpara> + この関数は、渡された引数のみのコピーを返します。 + デフォルトの(渡されていない)引数については考慮しません。 + </simpara> + </note> + + &note.funcnoparam; + <para> <informalexample> <programlisting role="php"> @@ -48,11 +60,6 @@ これによりユーザ定義の章において可変長の引数リストを使用することが できるようになります。 </simpara> - <note> - <simpara> - この関数はPHP4で追加されました。 - </simpara> - </note> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/func-get-arg.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-ja/reference/funchand/functions/func-get-arg.xml diff -u phpdoc-ja/reference/funchand/functions/func-get-arg.xml:1.6 phpdoc-ja/reference/funchand/functions/func-get-arg.xml:1.7 --- phpdoc-ja/reference/funchand/functions/func-get-arg.xml:1.6 Mon Nov 22 23:45:34 2004 +++ phpdoc-ja/reference/funchand/functions/func-get-arg.xml Mon Aug 15 12:11:31 2005 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.6 $ --> -<!-- EN-Revision: 1.4 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.7 $ --> +<!-- EN-Revision: 1.8 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.func-get-arg"> <refnamediv> <refname>func_get_arg</refname> @@ -17,11 +18,16 @@ 番目の引数を返します。関数の引数はゼロから数えられます。 <function>func_get_arg</function> は関数定義以外の場所で コールされた場合に警告を発生します。 + この関数を、直接他の関数のパラメータとして使用することはできません。 + その代わりに、いったん結果を変数に格納し、それを関数に渡します。 </simpara> <simpara> <parameter>arg_num</parameter> が実際に渡された引数の数よりも大き い場合は警告を発生し、<function>func_get_arg</function>は &false;を返します。 </simpara> + + &note.funcnoparam; + <para> <informalexample> <programlisting role="php"> @@ -48,11 +54,6 @@ <function>func_get_args</function>と組み合わせて使用され、これにより ユーザ定義の関数が可変長の引数リストをとることができるようになります。 </simpara> - <note> - <simpara> - この関数はPHP4で追加されました。 - </simpara> - </note> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/create-function.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-ja/reference/funchand/functions/create-function.xml diff -u phpdoc-ja/reference/funchand/functions/create-function.xml:1.4 phpdoc-ja/reference/funchand/functions/create-function.xml:1.5 --- phpdoc-ja/reference/funchand/functions/create-function.xml:1.4 Mon Nov 22 23:45:34 2004 +++ phpdoc-ja/reference/funchand/functions/create-function.xml Mon Aug 15 12:11:31 2005 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.4 $ --> -<!-- EN-Revision: 1.6 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.5 $ --> +<!-- EN-Revision: 1.7 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.create-function"> <refnamediv> <refname>create_function</refname> @@ -55,8 +56,8 @@ <?php function process($var1, $var2, $farr) { - for ($f=0; $f < count($farr); $f++) { - echo $farr[$f]($var1, $var2) . "\n"; + foreach ($farr as $f) { + echo $f($var1, $var2) . "\n"; } } http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/call-user-func.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-ja/reference/funchand/functions/call-user-func.xml diff -u phpdoc-ja/reference/funchand/functions/call-user-func.xml:1.6 phpdoc-ja/reference/funchand/functions/call-user-func.xml:1.7 --- phpdoc-ja/reference/funchand/functions/call-user-func.xml:1.6 Sun Jan 2 02:23:32 2005 +++ phpdoc-ja/reference/funchand/functions/call-user-func.xml Mon Aug 15 12:11:31 2005 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.6 $ --> -<!-- EN-Revision: 1.10 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.7 $ --> +<!-- EN-Revision: 1.13 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.call-user-func"> <refnamediv> <refname>call_user_func</refname> @@ -38,17 +39,15 @@ この関数のパラメータ<parameter>function</parameter>に <literal>array($objectname, $methodname)</literal>を指定することにより、 オブジェクトのメソッドも静的にコールすることができます。 - </para> - <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php class myclass { - function say_hello() - { - echo "Hello!\n"; - } + function say_hello() + { + echo "Hello!\n"; + } } $classname = "myclass"; @@ -59,9 +58,34 @@ </programlisting> </informalexample> </para> + <note> + <para> + <function>call_user_func</function> のパラメータは + 参照渡しではないことに注意しましょう。 + <informalexample> + <programlisting role="php"> +<![CDATA[ +<?php +function increment(&$var) +{ + $var++; +} + +$a = 0; +call_user_func('increment', $a); +echo $a; // 0 + +call_user_func_array('increment', array(&$a)); // 代わりにこうする +echo $a; // 1 +?> +]]> + </programlisting> + </informalexample> + </para> + </note> <para> - <function>is_callable</function>および - <function>call_user_func_array</function>も参照してください。 + <function>is_callable</function> および + <function>call_user_func_array</function> も参照してください。 </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/functions/call-user-func-array.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-ja/reference/funchand/functions/call-user-func-array.xml diff -u phpdoc-ja/reference/funchand/functions/call-user-func-array.xml:1.6 phpdoc-ja/reference/funchand/functions/call-user-func-array.xml:1.7 --- phpdoc-ja/reference/funchand/functions/call-user-func-array.xml:1.6 Sun Jan 2 02:23:32 2005 +++ phpdoc-ja/reference/funchand/functions/call-user-func-array.xml Mon Aug 15 12:11:31 2005 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.6 $ --> -<!-- EN-Revision: 1.10 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.7 $ --> +<!-- EN-Revision: 1.14 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.call-user-func-array"> <refnamediv> <refname>call_user_func_array</refname> @@ -13,13 +14,16 @@ <methodsynopsis> <type>mixed</type><methodname>call_user_func_array</methodname> <methodparam><type>callback</type><parameter>function</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>param_arr</parameter></methodparam> + <methodparam><type>array</type><parameter>param_arr</parameter></methodparam> </methodsynopsis> <para> <parameter>param_arr</parameter> にパラメータを指定して、 <parameter>function</parameter>で指定したユーザ定義関数をコー ルします。例えば次のようになります。 - <informalexample> + </para> + <para> + <example> + <title><function>call_user_func_array</function> の例</title> <programlisting role="php"> <![CDATA[ <?php @@ -43,10 +47,11 @@ ?> ]]> </programlisting> - </informalexample> + </example> </para> <para> - <function>call_user_func</function>も参照してください。 + <function>call_user_func</function>, + および &seealso.callback; </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/funchand/reference.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc-ja/reference/funchand/reference.xml diff -u phpdoc-ja/reference/funchand/reference.xml:1.5 phpdoc-ja/reference/funchand/reference.xml:1.6 --- phpdoc-ja/reference/funchand/reference.xml:1.5 Mon Nov 22 23:45:34 2004 +++ phpdoc-ja/reference/funchand/reference.xml Mon Aug 15 12:11:32 2005 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.5 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.6 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <reference id="ref.funchand"> <title>関数処理関数(funchand)</title> <titleabbrev>関数</titleabbrev>
« previous php.doc.ja (#1127) next »