LoginSignup
2
0

More than 5 years have passed since last update.

PHPの空白文字(\s)には全角スペースが含まれる

Posted at

正規表現で検索して\sを調べると全角スペースは含まれないというところが多い。
とりあえずPHPで試したら以下のようになりました。

$str = ' あいうえお ';

$result = mb_ereg_replace('\s', '', $str);

var_dump($result);

全角スペースが対象(ver 5.6.2)

string(15) "あいうえお"

全角スペースが対象外(ver 5.5.34)

string(18) "あいうえお "
2
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
2
0