I'm trying to call a function from within a heredoc, and I read in the manual (example #2) that it is possible. However, I get the following error: Notice: Undefined property: TIME::$since on line 13.
1 <?php class TIME {
2 var $month;
3 var $year;
4 public function since($y) {
5 $this->$month = (date("F"));
6 $this->$year = (date("Y")-$y);
7 return "(since $month of $year)";
8 // return "(since date('F') of {date('Y')-$y})";
9 }
10 }
11 $time = new TIME;
12 echo <<<EOF
13 {$time->since{1}};
14 EOF; ?>
What I need to do is pass 1 as an integer to the function since() and return a string like (since January of 2011).
{$time->since(1)}instead of{$time->since{1}}?