$string = 'cup'; $name = 'coffee'; $str = ”This is a $string with my $name in it.“; echo $str; 上边的程序也可打印出This is a cup with my coffee in it. 双引号中的变量,输出会自动转化它的值,单引则相反! 上边的程序是一个道理! 变一下就是这样: $string = 'cup'; $name = 'coffee'; $str = "This is a $string with my $name in it."; echo $str. "\n"; $str="$str"; echo $str. "\n";
$name = 'coffee';
$str = ”This is a $string with my $name in it.“;
echo $str;
上边的程序也可打印出This is a cup with my coffee in it.
双引号中的变量,输出会自动转化它的值,单引则相反!
上边的程序是一个道理!
变一下就是这样:
$string = 'cup';
$name = 'coffee';
$str = "This is a $string with my $name in it.";
echo $str. "\n";
$str="$str";
echo $str. "\n";