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?

More than 1 year has passed since last update.

[PHP]文字列の連結

Posted at

文字列連結の方法

phpでの文字列の連結は、**.(ドット)**を用いる。

$x = "PHP";
echo $x."入門";
//結果:PHP入門

//以下の通り、省略して書くことも可能
$x = "PHP";
$x = $x."入門";
 $x .= "入門";
echo $x;
//結果:PHP入門

""(ダブルクォーテーション)で囲んだ文字列の中に、
{}で囲った変数を記載すると、変数の内容が代入されている値に置き換わる。

$name = "太郎";
echo "私の名前は、{$name}です";
//結果:私の名前は、太郎です
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?