PHP中的字符串大括號何謂{ }(大括號)用PHP中的字符串字面值表示?
3 回答

函數式編程
TA貢獻1807條經驗 獲得超9個贊
<?php $a = '12345';// This works: echo "qwe{$a}rty"; // qwe12345rty, using braces echo "qwe" . $a . "rty"; // qwe12345rty, concatenation used// Does not work: echo 'qwe{$a}rty'; // qwe{$a}rty, single quotes are not parsed echo "qwe$arty"; // qwe, because $a became $arty, which is undefined?>

MM們
TA貢獻1886條經驗 獲得超2個贊
$number = 4;print "You have the {$number}th edition book";//output: "You have the 4th edition book";
$numberth
- 3 回答
- 0 關注
- 741 瀏覽
添加回答
舉報
0/150
提交
取消