Jump to content

calling object methods inside complex (curly) syntax fails for some php versions


lamad

Recommended Posts

Calling object methods inside complex (curly) syntax fails for some php versions.  Strangely the [url=http://php.net/string]PHP docs on this[/url] do not mention anything.  here is some simple code to illustrate the problem:

[code]
class foobar{
    function bar(){
        echo 'blah';
    }
}

$foo = new foobar();

echo <<<EOD
    <br /> this does not work on with some versions: {$foo->bar()}
EOD;
[/code]

What I would like to know is: in which version of PHP did calling object methods begin to work?  If anyone can point me to authoritative information on this or test the code and report which versions do or do not work I would appreciate it!

So far I have it working on: PHP 5.1.6
Not working on: PHP 4.4.0
[quote]Odd, I can't edit my own posts?[/quote]
15 minute limit on editing time for this form, 2 minutes for others (or it was last time I checked)

About your other problem, maybe there is just a different in the way normal variables, and OOP references are used during extrapolation.

I ran some searches on google, and didn't see anything about it.

In this specific situation, you are calling a function.

I don't know if you can directly just call a function in the middle of it like that.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.