Re: question about <<<EOF



On Tue, 30 Sep 2008 12:48:35 +0800, LKSunny wrote:

i want on inner EOF do something, calculate and call function ? can not ? if
yes, how to ?

Same way as you do with "" strings. e.g.

<?php
class foo {
function bar() {
return 'world!';
}

function hello() {
echo <<<ENDHELLO
Hello, {$this->bar()}
ENDHELLO;
}
}

$foo = new foo();
$foo->hello();
?>
--
Ross McKay, Toronto, NSW Australia
"Let the laddie play wi the knife - he'll learn"
- The Wee Book of Calvin
.



Relevant Pages

  • Re: session variables?
    ... function bar() {echo "foobar";} ... I will answer all pertinent mails from a valid address. ...
    (comp.lang.php)
  • Re: Referencing returned objects directly
    ... function in PHP? ... echo ReturnAnObject->SomeMember; ... public $bar = 'bar'; ...
    (comp.lang.php)
  • Object in array turns into reference when I access it.
    ... I'm running PHP Version 4.3.7 ... function bar() { ...
    (comp.lang.php)
  • Re: Classes and funtions
    ... echo $oFoo->getValue; ... call it, and it will manipulate the data without you knowing how it does it, ... OOP is a good idea. ...
    (comp.lang.php)
  • Re: include problem
    ... Functions (so not class methods) are in the 'global namespace', even if they're declared within functions or methods.. ... echo 'baz1'; ... If they're doing the same thing, use a conditional declaration with function_exists. ...
    (comp.lang.php)