cvs: phpdoc-ja /features persistent-connections.xml safe-mode.xml /language control-structures.xml /language/oop5 reflection.xml
/language/predefined/exception construct.xml /reference/array/functions array-fill.xml array-key-exists.xml array-map.xml /reference/curl/functions
curl-multi-add-handle.xml curl-multi-close.xml curl-multi-init.xml /reference/datetime/functions date.xml /reference/filesystem/functions stat.xml
touch.xml /reference/funchand/functions call-user-func-array.xml call-user-func.xml /reference/http/HttpRequest getHistory.xml /reference/image
examples.xml /reference/memcache/functions memcache-addserver.xml /reference/strings/functions setlocale.xml /security filesystem.xml

From: Date: Fri, 05 Sep 2008 11:58:14 +0000
Subject: cvs: phpdoc-ja /features persistent-connections.xml safe-mode.xml /language control-structures.xml /language/oop5 reflection.xml
/language/predefined/exception construct.xml /reference/array/functions array-fill.xml array-key-exists.xml array-map.xml /reference/curl/functions
curl-multi-add-handle.xml curl-multi-close.xml curl-multi-init.xml /reference/datetime/functions date.xml /reference/filesystem/functions stat.xml
touch.xml /reference/funchand/functions call-user-func-array.xml call-user-func.xml /reference/http/HttpRequest getHistory.xml /reference/image
examples.xml /reference/memcache/functions memcache-addserver.xml /reference/strings/functions setlocale.xml /security filesystem.xml
Groups: php.doc.ja 
Request: Send a blank email to doc-ja+get-2367@lists.php.net to get a copy of this message
takagi Fri Sep 5 11:58:14 2008 UTC Modified files: /phpdoc-ja/security filesystem.xml /phpdoc-ja/reference/strings/functions setlocale.xml /phpdoc-ja/reference/memcache/functions memcache-addserver.xml /phpdoc-ja/reference/image examples.xml /phpdoc-ja/reference/http/HttpRequest getHistory.xml /phpdoc-ja/reference/funchand/functions call-user-func.xml call-user-func-array.xml /phpdoc-ja/reference/filesystem/functions touch.xml stat.xml /phpdoc-ja/reference/datetime/functions date.xml /phpdoc-ja/reference/curl/functions curl-multi-init.xml curl-multi-close.xml curl-multi-add-handle.xml /phpdoc-ja/reference/array/functions array-map.xml array-key-exists.xml array-fill.xml /phpdoc-ja/language/predefined/exception construct.xml /phpdoc-ja/language/oop5 reflection.xml /phpdoc-ja/language control-structures.xml /phpdoc-ja/features safe-mode.xml persistent-connections.xml Log: sync with en.

http://cvs.php.net/viewvc.cgi/phpdoc-ja/security/filesystem.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc-ja/security/filesystem.xml diff -u phpdoc-ja/security/filesystem.xml:1.5 phpdoc-ja/security/filesystem.xml:1.6 --- phpdoc-ja/security/filesystem.xml:1.5 Fri Jun 22 14:32:58 2007 +++ phpdoc-ja/security/filesystem.xml Fri Sep 5 11:58:12 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.6 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.7 Maintainer: hirokawa Status: ready --> <chapter xml:id="security.filesystem" xmlns="http://docbook.org/ns/docbook"> <title>ファイルシステムのセキュリティ</title> @@ -100,7 +100,7 @@ $logstring = "$filepath の削除に失敗しました\n"; } $fp = fopen("/home/logging/filedelete.log", "a"); -fwrite($fp, $lo gstring); +fwrite($fp, $logstring); fclose($fp); echo htmlentities($logstring, ENT_QUOTES); http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/strings/functions/setlocale.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc-ja/reference/strings/functions/setlocale.xml diff -u phpdoc-ja/reference/strings/functions/setlocale.xml:1.10 phpdoc-ja/reference/strings/functions/setlocale.xml:1.11 --- phpdoc-ja/reference/strings/functions/setlocale.xml:1.10 Wed Aug 27 20:12:17 2008 +++ phpdoc-ja/reference/strings/functions/setlocale.xml Fri Sep 5 11:58:12 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.10 $ --> -<!-- EN-Revision: 1.31 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.11 $ --> +<!-- EN-Revision: 1.32 Maintainer: hirokawa Status: ready --> <!-- CREDITS: shimooka --> <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.setlocale"> <refnamediv> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/memcache/functions/memcache-addserver.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc-ja/reference/memcache/functions/memcache-addserver.xml diff -u phpdoc-ja/reference/memcache/functions/memcache-addserver.xml:1.11 phpdoc-ja/reference/memcache/functions/memcache-addserver.xml:1.12 --- phpdoc-ja/reference/memcache/functions/memcache-addserver.xml:1.11 Thu Jun 5 06:04:11 2008 +++ phpdoc-ja/reference/memcache/functions/memcache-addserver.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.12 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.13 Maintainer: takagi Status: ready --> <refentry xml:id="function.memcache-addserver" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>Memcache::addServer</refname> @@ -32,8 +32,8 @@ </para> <para> - (<function>Memcache::connect()</function> および - <function>Memcache::pconnect()</function> ではなく) + (<function>Memcache::connect</function> および + <function>Memcache::pconnect</function> ではなく) このメソッドを使用すると、ネットワーク接続は それが実際に必要となるときまで確率されません。 つまり、大量のサーバをプールに追加した場合に、 http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/image/examples.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-ja/reference/image/examples.xml diff -u phpdoc-ja/reference/image/examples.xml:1.1 phpdoc-ja/reference/image/examples.xml:1.2 --- phpdoc-ja/reference/image/examples.xml:1.1 Mon Dec 24 02:49:15 2007 +++ phpdoc-ja/reference/image/examples.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <!-- CREDITS: hirokawa --> <chapter xml:id="image.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> @@ -8,7 +8,7 @@ <section xml:id="image.examples-png"> <para> <example> - <title>PHPによるPNGの生成</title> + <title>PHP による PNG の生成</title> <programlisting role="php"> <![CDATA[ <?php @@ -27,13 +27,99 @@ </programlisting> </example> この例のスクリプトは、&lt;img src=&quot;button.php?text&quot;&gt; - のようなタグによりあるページからコールされるものです。 - 上のbutton.phpスクリプトは、この &quot;text&quot; 文字列を引数と - し、この場合は &quot;images/button1.png&quot; である基本イメージ - の最上部にこの文字列を描いた後、描画後ののイメージを出力します。 - この方法は、ボタンのテキストを変更する度に新規のボタンを生成する - 必要があるのを回避するために便利な手法です。 - この方法により、動的にイメージボタンを生成できます。 + のようなタグが書かれたページからコールされるものです。 + 上の button.php スクリプトは、この &quot;text&quot; 文字列を引数とし、 + 基本画像 &quot;images/button1.png&quot; + の上にこの文字列を重ねて描いた後、その画像を出力します。 + この方法を使うと、ボタンのテキストが変わるたびに新たなボタンを作り直す羽目になることを回避できます。 + この方法により、動的に画像ボタンを生成できるのです。 + </para> + </section> + <section xml:id="image.examples-watermark"> + <para> + <example> + <title>アルファチャネルを使用した、画像へのすかしの追加</title> + <programlisting role="php"> +<![CDATA[ +<?php +// スタンプと、それをすかしとして適用する写真を読み込みます +$stamp = imagecreatefrompng('stamp.png'); +$im = imagecreatefromjpeg('photo.jpeg'); + +// スタンプの余白を設定し、スタンプ画像の幅と高さを取得します +$marge_right = 10; +$marge_bottom = 10; +$sx = imagesx($stamp); +$sy = imagesy($stamp); + +// スタンプ画像を写真の上にコピーします。余白の値と +// 写真の幅を元にスタンプの位置を決定します +imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp)); + +// 出力し、メモリを開放します +header('Content-type: image/png'); +imagepng($im); +imagedestroy($im); +?> +]]> + </programlisting> + <mediaobject> + <imageobject> + <imagedata fileref="figures/image.watermarks.png" /> + </imageobject> + </mediaobject> + </example> + この例は、すかしやスタンプを写真あるいは著作権つき画像に追加するための一般的な方法です。 + スタンプ画像内のアルファチャネルのテキストはアンチエイリアス処理されることに注意しましょう。 + 画像をコピーしてもこれは残り続けます。 + </para> + </section> + <section xml:id="image.examples.merged-watermark"> + <para> + <example> + <title><function>imagecopymerge</function> による半透明なすかしの作成</title> + <programlisting role="php"> +<![CDATA[ +<?php +// スタンプと、それをすかしとして適用する写真を読み込みます +$im = imagecreatefromjpeg('photo.jpeg'); + +// まず、スタンプ画像を GD で作成します +$stamp = imagecreatetruecolor(100, 70); +imagefilledrectangle($stamp, 0,0, 99, 99, 0x0000FF); +imagefilledrectangle($stamp, 9,9, 90,60, 0xFFFFFF); +$im = imagecreatefromjpeg('photo.jpeg'); +imagestring($stamp, 5, 20, 20, 'libGD', 0x0000FF); +imagestring($stamp, 3, 20, 40, '(c) 2007-8', 0x0000FF); + +// スタンプの余白を設定し、スタンプ画像の幅と高さを取得します +$marge_right = 10; +$marge_bottom = 10; +$sx = imagesx($stamp); +$sy = imagesy($stamp); + +// スタンプを、50% の不透明度で写真に重ねます +imagecopymerge($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp), 50); + +// 画像をファイルに保存し、メモリを開放します +imagepng($im, 'photo_stamp.png'); +imagedestroy($im); + +?> +]]> + </programlisting> + <mediaobject> + <imageobject> + <imagedata fileref="figures/image.watermark-merged.png" /> + </imageobject> + </mediaobject> + </example> + この例は、<function>imagecopymerge</function> + を使ってスタンプを元画像にかぶせます。 + これを使うと、スタンプの不透明度を設定することができます。 + 今回の例では 50% の不透明度に設定しています。 + この半透明のすかしを用いる方法は、著作権つきの画像を保護するのに便利です。 + すかしをとるのは非常に難しく、またもとの画像の見栄えも損ねません。 </para> </section> </chapter> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/http/HttpRequest/getHistory.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc-ja/reference/http/HttpRequest/getHistory.xml diff -u phpdoc-ja/reference/http/HttpRequest/getHistory.xml:1.4 phpdoc-ja/reference/http/HttpRequest/getHistory.xml:1.5 --- phpdoc-ja/reference/http/HttpRequest/getHistory.xml:1.4 Thu Jun 5 05:58:37 2008 +++ phpdoc-ja/reference/http/HttpRequest/getHistory.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.4 $ --> -<!-- EN-Revision: 1.4 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.5 $ --> +<!-- EN-Revision: 1.5 Maintainer: takagi Status: ready --> <refentry xml:id="function.httprequest-gethistory" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>HttpRequest::getHistory</refname> @@ -26,7 +26,7 @@ <para> 返されるオブジェクトは、直近に受け取ったレスポンスを参照しています。 それ以前に送信したリクエストや受信したレスポンスにアクセスするには - <function>HttpMessage::getParentMessage()</function> を使用します。 + <function>HttpMessage::getParentMessage</function> を使用します。 </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/funchand/functions/call-user-func.xml?r1=1.13&r2=1.14&diff_format=u Index: phpdoc-ja/reference/funchand/functions/call-user-func.xml diff -u phpdoc-ja/reference/funchand/functions/call-user-func.xml:1.13 phpdoc-ja/reference/funchand/functions/call-user-func.xml:1.14 --- phpdoc-ja/reference/funchand/functions/call-user-func.xml:1.13 Fri Jan 25 21:46:23 2008 +++ phpdoc-ja/reference/funchand/functions/call-user-func.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.13 $ --> -<!-- EN-Revision: 1.19 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.14 $ --> +<!-- EN-Revision: 1.20 Maintainer: hirokawa Status: ready --> <!-- CREDITS: takagi --> <refentry xml:id="function.call-user-func" xmlns="http://docbook.org/ns/docbook"> <refnamediv> @@ -143,6 +143,19 @@ ]]> </programlisting> </example> + <example> + <title>ラムダ関数の使用</title> + <programlisting role="php"> +<![CDATA[ +<?php + +call_user_func(function($arg) { print "[$arg]\n"; }, 'test'); /* PHP 5.3.0 以降 */ +// [test] + +?> +]]> + </programlisting> + </example> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/funchand/functions/call-user-func-array.xml?r1=1.11&r2=1.12&diff_format=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.11 phpdoc-ja/reference/funchand/functions/call-user-func-array.xml:1.12 --- phpdoc-ja/reference/funchand/functions/call-user-func-array.xml:1.11 Thu Jan 24 06:52:28 2008 +++ phpdoc-ja/reference/funchand/functions/call-user-func-array.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.19 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.20 Maintainer: hirokawa Status: ready --> <!-- CREDITS: takagi --> <refentry xml:id="function.call-user-func-array" xmlns="http://docbook.org/ns/docbook"> <refnamediv> @@ -107,6 +107,23 @@ ]]> </programlisting> </example> + <example> + <title>ラムダ関数の使用</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$func = function($arg1, $arg2) { + return $arg1 * $arg2; +}; + +var_dump(call_user_func($func, 2, 4)); /* PHP 5.3.0 以降 */ +// int(8) + +?> +]]> + </programlisting> + </example> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/filesystem/functions/touch.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc-ja/reference/filesystem/functions/touch.xml diff -u phpdoc-ja/reference/filesystem/functions/touch.xml:1.12 phpdoc-ja/reference/filesystem/functions/touch.xml:1.13 --- phpdoc-ja/reference/filesystem/functions/touch.xml:1.12 Mon Aug 25 20:42:26 2008 +++ phpdoc-ja/reference/filesystem/functions/touch.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.12 $ --> -<!-- EN-Revision: 1.18 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.13 $ --> +<!-- EN-Revision: 1.20 Maintainer: hirokawa Status: ready --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.touch"> <refnamediv> <refname>touch</refname> @@ -111,6 +111,32 @@ </programlisting> </example> </para> + <para> + <example> + <title><function>touch</function> で <parameter>time</parameter> パラメータを使用する例</title> + <programlisting role="php"> +<![CDATA[ +<?php +/* + * 作成時刻を、ここでは + * 1 時間前に設定します + */ +$time = time() - 3600; + +/* ファイルを作成します */ +if(!touch('some_file.txt', $time)) +{ + echo 'おっと、何かがおかしいようです...'; +} +else +{ + echo 'ファイルの作成に成功しました'; +} +?> +]]> + </programlisting> + </example> + </para> </refsect1> <refsect1 role="notes"> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/filesystem/functions/stat.xml?r1=1.15&r2=1.16&diff_format=u Index: phpdoc-ja/reference/filesystem/functions/stat.xml diff -u phpdoc-ja/reference/filesystem/functions/stat.xml:1.15 phpdoc-ja/reference/filesystem/functions/stat.xml:1.16 --- phpdoc-ja/reference/filesystem/functions/stat.xml:1.15 Mon Aug 25 20:42:26 2008 +++ phpdoc-ja/reference/filesystem/functions/stat.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.15 $ --> -<!-- EN-Revision: 1.22 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.16 $ --> +<!-- EN-Revision: 1.24 Maintainer: hirokawa Status: ready --> <!-- CREDITS: shimooka --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.stat"> <refnamediv> @@ -169,6 +169,74 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>stat</function> の例</title> + <programlisting role="php"> +<![CDATA[ +<?php +/* ファイルの状態を取得します */ +$stat = stat('C:\php\php.exe'); + +/* + * ファイルのアクセス日時を表示します。 + * これは fileatime() をコールするのと同じです + */ +echo 'アクセス日時: ' . $stat['atime']; + +/* + * ファイルの更新日時を表示します。 + * これは filemtime() をコールするのと同じです + */ +echo '更新日時: ' . $stat['mtime']; + +/* デバイス番号を表示します */ +echo 'デバイス番号: ' . $stat['dev']; +]]> + </programlisting> + </example> + </para> + <para> + <example> + <title><function>stat</function> の情報を <function>touch</function> と組み合わせる例</title> + <programlisting role="php"> +<![CDATA[ +<?php +/* ファイルの状態を取得します */ +$stat = @stat('C:\php\php.exe'); + +/* 情報の取得に失敗した ? */ +if(!$stat) +{ + echo 'Stat のコールに失敗しました...'; +} +else +{ + /* + * アクセス日時を、現在のアクセス日時の + * 一週間後に設定します + */ + $atime = $stat['atime'] + 604800; + + /* ファイルを作成します */ + if(!@touch('some_file.txt', time(), $atime)) + { + echo 'ファイルの作成に失敗しました...'; + } + else + { + echo 'ファイルの作成に成功しました...'; + } +} +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + <refsect1 role="notes"> &reftitle.notes; &note.filesystem-time-res; http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/datetime/functions/date.xml?r1=1.29&r2=1.30&diff_format=u Index: phpdoc-ja/reference/datetime/functions/date.xml diff -u phpdoc-ja/reference/datetime/functions/date.xml:1.29 phpdoc-ja/reference/datetime/functions/date.xml:1.30 --- phpdoc-ja/reference/datetime/functions/date.xml:1.29 Tue Jan 15 12:37:17 2008 +++ phpdoc-ja/reference/datetime/functions/date.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.29 $ --> -<!-- EN-Revision: 1.42 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.30 $ --> +<!-- EN-Revision: 1.43 Maintainer: hirokawa Status: ready --> <!-- CREDITS: shimooka,takagi --> <refentry xml:id="function.date" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> @@ -217,7 +217,7 @@ </row> <row> <entry><literal>u</literal></entry> - <entry>ミリ秒 (PHP 5.2.2 で追加)。</entry> + <entry>マイクロ秒 (PHP 5.2.2 で追加)。</entry> <entry>例: <literal>54321</literal></entry> </row> <row> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/curl/functions/curl-multi-init.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc-ja/reference/curl/functions/curl-multi-init.xml diff -u phpdoc-ja/reference/curl/functions/curl-multi-init.xml:1.4 phpdoc-ja/reference/curl/functions/curl-multi-init.xml:1.5 --- phpdoc-ja/reference/curl/functions/curl-multi-init.xml:1.4 Fri Jun 22 14:31:41 2007 +++ phpdoc-ja/reference/curl/functions/curl-multi-init.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.4 $ --> -<!-- EN-Revision: 1.7 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.5 $ --> +<!-- EN-Revision: 1.8 Maintainer: takagi Status: ready --> <refentry xml:id="function.curl-multi-init" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>curl_multi_init</refname> @@ -69,8 +69,8 @@ } while ($running > 0); // ハンドルを閉じます -curl_multi_remove_handle($ch1); -curl_multi_remove_handle($ch2); +curl_multi_remove_handle($mh, $ch1); +curl_multi_remove_handle($mh, $ch2); curl_multi_close($mh); ?> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/curl/functions/curl-multi-close.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc-ja/reference/curl/functions/curl-multi-close.xml diff -u phpdoc-ja/reference/curl/functions/curl-multi-close.xml:1.4 phpdoc-ja/reference/curl/functions/curl-multi-close.xml:1.5 --- phpdoc-ja/reference/curl/functions/curl-multi-close.xml:1.4 Fri Jun 22 14:31:41 2007 +++ phpdoc-ja/reference/curl/functions/curl-multi-close.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.4 $ --> -<!-- EN-Revision: 1.7 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.5 $ --> +<!-- EN-Revision: 1.8 Maintainer: takagi Status: ready --> <refentry xml:id="function.curl-multi-close" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>curl_multi_close</refname> @@ -67,9 +67,10 @@ do { curl_multi_exec($mh,$running); } while ($running > 0) + // ハンドルを閉じます -curl_multi_remove_handle($ch1); -curl_multi_remove_handle($ch2); +curl_multi_remove_handle($mh, $ch1); +curl_multi_remove_handle($mh, $ch2); curl_multi_close($mh); ?> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/curl/functions/curl-multi-add-handle.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc-ja/reference/curl/functions/curl-multi-add-handle.xml diff -u phpdoc-ja/reference/curl/functions/curl-multi-add-handle.xml:1.4 phpdoc-ja/reference/curl/functions/curl-multi-add-handle.xml:1.5 --- phpdoc-ja/reference/curl/functions/curl-multi-add-handle.xml:1.4 Fri Jun 22 14:31:41 2007 +++ phpdoc-ja/reference/curl/functions/curl-multi-add-handle.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.4 $ --> -<!-- EN-Revision: 1.8 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.5 $ --> +<!-- EN-Revision: 1.9 Maintainer: takagi Status: ready --> <refentry xml:id="function.curl-multi-add-handle" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>curl_multi_add_handle</refname> @@ -73,8 +73,8 @@ } while($running > 0); // すべてのハンドルを閉じます -curl_multi_remove_handle($ch1); -curl_multi_remove_handle($ch2); +curl_multi_remove_handle($mh, $ch1); +curl_multi_remove_handle($mh, $ch2); curl_multi_close($mh); ?> ]]> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/array/functions/array-map.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc-ja/reference/array/functions/array-map.xml diff -u phpdoc-ja/reference/array/functions/array-map.xml:1.10 phpdoc-ja/reference/array/functions/array-map.xml:1.11 --- phpdoc-ja/reference/array/functions/array-map.xml:1.10 Thu Jan 24 06:52:28 2008 +++ phpdoc-ja/reference/array/functions/array-map.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.10 $ --> -<!-- EN-Revision: 1.20 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.11 $ --> +<!-- EN-Revision: 1.21 Maintainer: hirokawa Status: ready --> <refentry xml:id="function.array-map" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>array_map</refname> @@ -100,6 +100,34 @@ ]]> </screen> </example> + <example> + <title><function>array_map</function> でラムダ関数を使用する例 (PHP 5.3.0 以降)</title> + <programlisting role="php"> +<![CDATA[ +<?php + +/* PHP 5.3.0 以降 */ + +$func = function($value) { return $value * 2; }; + +print_r(array_map($func, range(1, 5))); + +?> +]]> + </programlisting> + <screen> +<![CDATA[ +Array +( + [0] => 2 + [1] => 4 + [2] => 6 + [3] => 8 + [4] => 10 +) +]]> + </screen> + </example> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/array/functions/array-key-exists.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc-ja/reference/array/functions/array-key-exists.xml diff -u phpdoc-ja/reference/array/functions/array-key-exists.xml:1.9 phpdoc-ja/reference/array/functions/array-key-exists.xml:1.10 --- phpdoc-ja/reference/array/functions/array-key-exists.xml:1.9 Fri Jun 22 14:31:37 2007 +++ phpdoc-ja/reference/array/functions/array-key-exists.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.9 $ --> -<!-- EN-Revision: 1.14 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.10 $ --> +<!-- EN-Revision: 1.16 Maintainer: hirokawa Status: ready --> <!-- CREDITS: shimooka --> <refentry xml:id="function.array-key-exists" xmlns="http://docbook.org/ns/docbook"> <refnamediv> @@ -19,7 +19,6 @@ 指定した <parameter>key</parameter> が配列に設定されている場合、 <function>array_key_exists</function> は &true; を返します。 <parameter>key</parameter> は配列添字として使用できる全ての値を使用可能です。 - <function>array_key_exists</function> はオブジェクトに対しても動作します。 </para> </refsect1> @@ -54,6 +53,31 @@ </para> </refsect1> + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.3.0</entry> + <entry> + この関数はオブジェクトに対しては使えなくなりました。オブジェクトについては + <function>property_exists</function> を使用します。 + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + <refsect1 role="examples"> &reftitle.examples; <para> @@ -107,6 +131,7 @@ <member><function>isset</function></member> <member><function>array_keys</function></member> <member><function>in_array</function></member> + <member><function>property_exists</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/array/functions/array-fill.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc-ja/reference/array/functions/array-fill.xml diff -u phpdoc-ja/reference/array/functions/array-fill.xml:1.10 phpdoc-ja/reference/array/functions/array-fill.xml:1.11 --- phpdoc-ja/reference/array/functions/array-fill.xml:1.10 Sat May 17 06:16:33 2008 +++ phpdoc-ja/reference/array/functions/array-fill.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.10 $ --> -<!-- EN-Revision: 1.14 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.11 $ --> +<!-- EN-Revision: 1.15 Maintainer: hirokawa Status: ready --> <refentry xml:id="function.array-fill" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>array_fill</refname> @@ -125,6 +125,7 @@ &reftitle.seealso; <para> <simplelist> + <member><function>array_fill_keys</function></member> <member><function>str_repeat</function></member> <member><function>range</function></member> </simplelist> http://cvs.php.net/viewvc.cgi/phpdoc-ja/language/predefined/exception/construct.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-ja/language/predefined/exception/construct.xml diff -u phpdoc-ja/language/predefined/exception/construct.xml:1.1 phpdoc-ja/language/predefined/exception/construct.xml:1.2 --- phpdoc-ja/language/predefined/exception/construct.xml:1.1 Fri Apr 18 23:38:25 2008 +++ phpdoc-ja/language/predefined/exception/construct.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> <refentry xml:id="exception.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> @@ -12,8 +12,8 @@ &reftitle.description; <constructorsynopsis> <modifier>public</modifier> <methodname>Exception::__construct</methodname> - <methodparam choice="opt"><type>string</type><parameter>message</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>code</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>message</parameter><initializer>NULL</initializer></methodparam> + <methodparam choice="opt"><type>int</type><parameter>code</parameter><initializer>0</initializer></methodparam> </constructorsynopsis> <para> 例外を作成します。 http://cvs.php.net/viewvc.cgi/phpdoc-ja/language/oop5/reflection.xml?r1=1.24&r2=1.25&diff_format=u Index: phpdoc-ja/language/oop5/reflection.xml diff -u phpdoc-ja/language/oop5/reflection.xml:1.24 phpdoc-ja/language/oop5/reflection.xml:1.25 --- phpdoc-ja/language/oop5/reflection.xml:1.24 Mon Aug 11 04:02:59 2008 +++ phpdoc-ja/language/oop5/reflection.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.24 $ --> -<!-- EN-Revision: 1.36 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.25 $ --> +<!-- EN-Revision: 1.38 Maintainer: hirokawa Status: ready --> <!-- CREDITS: shimooka --> <sect1 xml:id="language.oop5.reflection" xmlns="http://docbook.org/ns/docbook"> @@ -181,6 +181,7 @@ public string getName() public bool isInternal() public bool isDisabled() + public mixed getClosure() /* PHP 5.3.0 以降 */ public bool isUserDefined() public string getFileName() public int getStartLine() @@ -590,6 +591,7 @@ public bool isConstructor() public bool isDestructor() public int getModifiers() + public mixed getClosure() /* PHP 5.3.0 以降 */ public ReflectionClass getDeclaringClass() // ReflectionFunctionAbstract から継承したメソッド @@ -680,6 +682,27 @@ ]]> </programlisting> </example> + <example> + <title><classname>ReflectionMethod</classname> クラスを用いたクロージャの取得</title> + <programlisting role='php'> +<![CDATA[ +<?php + +class Example { + static function printer () { + echo "Hello World!\n"; + } +} + +$class = new ReflectionClass('Example'); +$method = $class->getMethod('printer'); +$closure = $method->getClosure(); /* PHP 5.3.0 以降 */ +$closure(); // Hello World! + +?> +]]> + </programlisting> + </example> <note> <simpara> private, protectedまたはabstractメソッドのinvokeを行うと、 @@ -782,6 +805,32 @@ var_dump($obj); ?> ]]> + </programlisting> + </example> + <example> + <title><classname>ReflectionProperty</classname> クラスを用いた、private および protected プロパティの値の取得</title> + <programlisting role='php'> +<![CDATA[ +<?php + +class Foo { + public $x = 1; + protected $y = 2; + private $z = 3; +} + +$obj = new Foo; + +$prop = new ReflectionProperty('Foo', 'y'); +$prop->setAccessible(true); /* PHP 5.3.0 以降 */ +var_dump($prop->getValue($obj)); // int(2) + +$prop = new ReflectionProperty('Foo', 'z'); +$prop->setAccessible(true); /* PHP 5.3.0 以降 */ +var_dump($prop->getValue($obj)); // int(2) + +?> +]]> </programlisting> </example> <note> http://cvs.php.net/viewvc.cgi/phpdoc-ja/language/control-structures.xml?r1=1.76&r2=1.77&diff_format=u Index: phpdoc-ja/language/control-structures.xml diff -u phpdoc-ja/language/control-structures.xml:1.76 phpdoc-ja/language/control-structures.xml:1.77 --- phpdoc-ja/language/control-structures.xml:1.76 Wed Aug 27 20:12:22 2008 +++ phpdoc-ja/language/control-structures.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.76 $ --> -<!-- EN-Revision: 1.165 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.77 $ --> +<!-- EN-Revision: 1.167 Maintainer: hirokawa Status: ready --> <!-- CREDITS: takagi,shimooka --> <chapter xml:id="language.control-structures" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> @@ -486,7 +486,61 @@ endfor; ]]> </programlisting> - </informalexample> + </informalexample> + </para> + <simpara> + 多くのユーザにとって、次の例のように配列をループ処理することはよくあるでしょう。 + </simpara> + <para> + <informalexample> + <programlisting> +<![CDATA[ +<?php +/* + * データが入った配列で、ループ処理中に + * その中身を書き換えたいと考えています + */ +$people = Array( + Array('name' => 'Kalle', 'salt' => 856412), + Array('name' => 'Pierre', 'salt' => 215863) + ); + +for($i = 0; $i < sizeof($people); ++$i) +{ + $people[$i]['salt'] = rand(000000, 999999); +} +?> +]]> + </programlisting> + </informalexample> + </para> + <simpara> + この書き方には問題があります。 + このコードは実行速度が遅くなることでしょう。 + 配列のサイズを毎回計算しているからです。 + サイズが変わることはないのですから、これは簡単に最適化することができます。 + 配列のサイズを変数に格納して、ループ内では sizeof + ではなくその変数の値を使えばいいのです。 + 以下に例を示します。 + </simpara> + <para> + <informalexample> + <programlisting> +<![CDATA[ +<?php +$people = Array( + Array('name' => 'Kalle', 'salt' => 856412), + Array('name' => 'Pierre', 'salt' => 215863) + ); + +for($i = 0, $size = sizeof($people); $i < $size; ++$i) +{ + $people[$i]['salt'] = rand(000000, 999999); +} +?> +]]> + </programlisting> + </informalexample> </para> </sect1> http://cvs.php.net/viewvc.cgi/phpdoc-ja/features/safe-mode.xml?r1=1.29&r2=1.30&diff_format=u Index: phpdoc-ja/features/safe-mode.xml diff -u phpdoc-ja/features/safe-mode.xml:1.29 phpdoc-ja/features/safe-mode.xml:1.30 --- phpdoc-ja/features/safe-mode.xml:1.29 Fri Apr 25 20:35:57 2008 +++ phpdoc-ja/features/safe-mode.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.29 $ --> -<!-- EN-Revision: 1.76 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.30 $ --> +<!-- EN-Revision: 1.77 Maintainer: hirokawa Status: ready --> <!-- CREDITS: shimooka --> <chapter xml:id="features.safe-mode" xmlns="http://docbook.org/ns/docbook"> <title>セーフモード</title> @@ -89,8 +89,7 @@ </tbody> </tgroup> </table> - PHP_INI_*の定義と詳細については、 - <function>ini_set</function>を参照してください。 + &ini.php.constants; </para> &ini.descriptions.title; http://cvs.php.net/viewvc.cgi/phpdoc-ja/features/persistent-connections.xml?r1=1.16&r2=1.17&diff_format=u Index: phpdoc-ja/features/persistent-connections.xml diff -u phpdoc-ja/features/persistent-connections.xml:1.16 phpdoc-ja/features/persistent-connections.xml:1.17 --- phpdoc-ja/features/persistent-connections.xml:1.16 Sat Feb 23 02:59:19 2008 +++ phpdoc-ja/features/persistent-connections.xml Fri Sep 5 11:58:13 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.16 $ --> -<!-- EN-Revision: 1.26 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.17 $ --> +<!-- EN-Revision: 1.27 Maintainer: hirokawa Status: ready --> <!-- CREDITS: shimooka --> <chapter xml:id="features.persistent-connections" xmlns="http://docbook.org/ns/docbook"> <title>持続的データベース接続</title> @@ -116,12 +116,12 @@ <emphasis>かもしれません</emphasis>(おそらく変えます)が、動作は変更しません! </simpara> <para> - See also <function>fbsql_pconnect</function>, + <function>fbsql_pconnect</function>, <function>ibase_pconnect</function>, <function>ifx_pconnect</function>, <function>ingres_pconnect</function>, <function>msql_pconnect</function>, <function>mssql_pconnect</function>, <function>mysql_pconnect</function>, <function>ociplogon</function>, - <function>odbc_pconnect</function>, <function>ora_plogon</function>, + <function>odbc_pconnect</function>, <function>oci_pconnect</function>, <function>pfsockopen</function>, <function>pg_pconnect</function>, <function>sybase_pconnect</function>も参照してください。 </para>
« previous php.doc.ja (#2367) next »