”(シングルクォーテーション)と””(ダブルクォーテーション)の違いの説明になります。
2つの大きな違い
$nbr = '3';
$txt1 = '$nbrシングルクォーテーション';
$txt2 = "{$nbr}ダブルクォーテーション";
// $nbrが文字列として、出力される
echo $txt1;
echo "<br>";
// $nbrが変数として出力される
echo $txt2;
echo
実行結果
// $nbrが文字列として、出力される $nbrシングルクォーテーション // $nbrが変数として出力される 3ダブルクォーテーション
シングルクォーテーションの方が処理速度が早いので変数と文字列を混合させて出力させる際にのみダブルクォーテーションを使用する方がよい。
Warning: Undefined variable $post_id in /home/baseline1/baseline-lib.com/public_html/memo/wp-content/themes/wpex-pronto/single.php on line 49
Warning: Undefined array key 0 in /home/baseline1/baseline-lib.com/public_html/memo/wp-content/themes/wpex-pronto/single.php on line 51