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
Link to comment
Share on other sites

[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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.