0
1

More than 1 year has passed since last update.

【PHP】文字化けせずに文字を抜き出す方法

Posted at

先頭の1文字を取得したい

mb_substrを使う

qiita.php
mb_substr("文字",0,1);
  • 結果

バイトで指定したいときはsubstr

substr("moji",0,1);
  • 結果
m

バイト指定なので文字を指定すると文字化けします

0
1
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
1