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

函數(shù)式編程
TA貢獻(xiàn)1807條經(jīng)驗(yàn) 獲得超9個(gè)贊
<?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貢獻(xiàn)1886條經(jīng)驗(yàn) 獲得超2個(gè)贊
$number = 4;print "You have the {$number}th edition book";//output: "You have the 4th edition book";
$numberth
- 3 回答
- 0 關(guān)注
- 739 瀏覽
添加回答
舉報(bào)
0/150
提交
取消