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

More than 1 year has passed since last update.

「'」や「"」をechoで表示したいとき

Posted at

・「'」や「"」をechoで表示したいとき

「I'm from Japan.」と表示したいとき、

echo 'I'm from Japan.';

では、シングルクォーテーション(')とアポストロフィー(')が同じ記号であるためエラーとなる。

これを解決する方法を載せておく。

①文字列をダブルクォーテーション(")で囲む

echo "I'm from Japan.";

②エスケープシーケンスを使う

echo 'I\'m from Japan.';
1
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
1
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?