LoginSignup
2
1

More than 3 years have passed since last update.

PHPで文字列\nしても改行されない

Last updated at Posted at 2019-06-25

原因

PHPのクオーテーションはシングルとダブルで動作が異なる。たまに書くと忘れる。

シングルクオーテーション:変数や特殊文字の置換を行わない。(そのまま出力)
ダブルクオーテーション :変数や特殊文字の置換を行う。

文字列の改行は"ほげ\n"
'ほげ\n'はだめ

2
1
1

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
1