tags:

views:

29

answers:

1

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 . '<br />';
+3  A: 

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;
Dan Heberden