$text = str_replace(array(" ", " ","\r\n", "\r", "\n"), "", $text);
<?php //文字列 $text = "「 」←半角空白「 」←全角空白「 」←半角空白3つ「 」←全角空白4つ"; //文字列の中にある半角空白と全角空白をすべて削除・除去する $text = str_replace(array(" ", " ","\r\n", "\r", "\n"), "", $text); //出力 echo $text; ?>このプログラムを実行すると、次のようになります。