[PHP-doc 612] Re: mb_strpos

HOTTA Michihide hotta @ net-newbie.com
2006年 2月 25日 (土) 18:47:05 JST


堀田@長崎市です。

# すみません、何が問題なのかわかってませんでした。

On Fri, 24 Feb 2006 21:11:47 +0900 
Subject: [PHP-doc 606] Re: mb_strpos
TAKAGI Masahiro <matakagi @ osk2.3web.ne.jp> wrote:

> で、strrpos() のマニュアルを見ると、以下のような記述があります。
> 
> Note that the needle in this case can only be a single character 
> in PHP 4. If a string is passed as the needle, then only the 
> first character of that string will be used.
> 
> Note:  The needle may be a string of more than one character 
> as of PHP 5.0.0.

On Sat, 25 Feb 2006 18:09:13 +0900 
Subject: [PHP-doc 611] Re: mb_strpos
Tadashi Jokagi <ml @ elf.no-ip.org> wrote:

> TAKAGI Masahiroさんの<m3irr5x8fw.wl%matakagi @ osk2.3web.ne.jp>から
> >print mb_strrpos($theString, "A") . "\n";   // => 9
> >print strrpos($theString, "A") . "\n";      // => 9
> >print mb_strrpos($theString, "ABC") . "\n"; // => 4
> >print strrpos($theString, "ABC") . "\n";    // => 9 (not 4!)
> 
>       仕様が違うって気づきませんでした.これってmb_strpos の
>     バグだと思うのですが,いかがでしょうか? 

たしかに手元の 5.1.2 だと、
9
9
4
4
になりますね。

1.mb_strrpos() は PHP4 ではバグってる。
2.(ちょっと無理があるけど(^^;) (1) を仕様と考えるなら、マニュア
  ルに PHP4 と PHP5 じゃ動作が違うよって書く。

やっぱり (1) ですよねぇ。。。

-- 
〒851-2195 長崎県西彼杵郡長与町まなび野1-1-1
県立長崎シーボルト大学 情報センター 堀田 倫英 <hotta @ sun.ac.jp>
TEL/FAX 095-813-5162  内線:4212



PHP-doc メーリングリストの案内