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;
精彩评论