开发者

php heredoc syntax question

Trying to output the following 5 but not sure how to do it. Any ideas?

<?php

$other='What are you like?';
 $content['my_name']=4;

$str=<<<JT
    here is some info. $other Do 
    you like the number {$content['my_name']+1} ? 
JT;

 echo $str . '<开发者_Python百科;br />';


As Pekka correctly stated:

$str=<<<JT
    here is some info. $other Do 
    you like the number {$content['my_name']+1} ? 
JT;

is invalid - only variables are parsed in the heredoc..

$content['my_name'] += 1;
$str=<<<JT
    here is some info. $other Do 
    you like the number {$content['my_name']} ? 
JT;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜