SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot ThetaWaveRider's Avatar
    Join Date
    Aug 2004
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Complex heredoc syntax and addition

    Hello,

    I'm using heredoc syntax, and I'm not sure how to add an integer to a variable (which holds an integer). Right now, I have the following:

    PHP Code:
    $mainbody = <<< EOD
    <h4>$first_article thru {$first_article 9} of $total_articles</h4>
    EOD; 
    When I run this, I get a "Parse error: parse error, expecting `'}" message. I don't see why the second curly bracket is not being understood. Any ideas, anyone?

    Thanks,
    TWR

  2. #2
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $first_article_tmp $first_article 9;

    $mainbody = <<< EOD
    <h4>{$first_article} thru {$first_article_tmp} of {$total_articles}</h4>
    EOD; 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •