0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PHP trim

Posted at

trim()の説明

余分な改行や空白を取り除く

基本的な使い方

$text = 'テストです ';
$trimmed_text = trim($text);
echo $trimmed_text;

出力値
テストです(スペースがなくなる。)
スペース以外にも改行やタブを表す\n\tも取り除くことが出来る。

また、以下のように取り除きたい文字を第2引数に指定して、削除する文字を指定することもできる。

trim(変数, '取り除きたい文字')
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?