LoginSignup
0
0

More than 5 years have passed since last update.

PHPで文字列中のアルファベット(半角英字)のみを削除する

Last updated at Posted at 2017-12-12

調べても無かったので方法を記載しておきます。

環境

PHP 7.2.0

方法

preg_replaceと正規表現を使用します。

php > $str = "Appleが好き";
php > echo preg_replace('/[a-zA-Z]/', '', $str);
が好き
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