0
0

More than 5 years have passed since last update.

mb_strpos関数に指定する引数

Posted at
$s = "あいう";
echo mb_strpos($s, "い");

なぜかこれで「2」と表示されてしまいました。解決するには文字コードを指定すれば良いとのこと(じゃあわざわざmbつける意味ってあるんですか?)。

$s = "あいう";
echo mb_strpos($s, "い", 0, "UTF-8");

1・文字列内を検索
2・指定した文字が最初に出る場所
3・検索開始する場所
4・文字コード

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0