解析数组
$juices = array(apple, orange, koolaid1 => purple);echohe drank some $juices[0] juice..php_eol;echohe drank some $juices[koolaid1] juice..php_eol;// 有效,只有通过花括号语法才能正确解析带引号的键名echothis works: {$arr['key']};// 有效echothis works: {$arr[4][3]};
解析变量
echothis is {$great};echothis is ${great};
输出字符串
$a = 'aaaa';$c['c'] = ccc;$b = i am '$a' and '$c[c]' \ 我是双引号!\;echo$b; //i am 'aaaa' and 'ccc' 我是双引号!
{}的解析
classbeers {const softdrink = 'rootbeer'; publicstatic$ale = 'ipa';}$rootbeer = 'a & w';$ipa = 'alexander keith\'s';// 有效,输出: i'd like an a & wechoi'd like an {${beers::softdrink}}\n;// 也有效,输出: i'd like an alexander keith'sechoi'd like an {${beers::$ale}}\n;
解析对象
// 有效echo this square is {$square->width}00 centimeters broad.;
版权声明:知识取之于民,用之于民!欢迎转载,转载请开头附上本文链接,不定期更新文章!
以上就介绍了php 双引号里面的解析,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
