SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Print qq| |; equivalent for echo?

    Just switching from Perl to PHP, so is there any equivalent for

    print qq|
    blah, blah etc
    blah, blah etc
    |;

    equivalent for echo? or anything similar to print mulitple lines without need of putting backslashes before code in HTML for echo <a href=\"blah.com\">.

    TIA.

  2. #2
    SitePoint Addict
    Join Date
    Aug 2005
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BigResource View Post
    Just switching from Perl to PHP, so is there any equivalent for

    print qq|
    blah, blah etc
    blah, blah etc
    |;

    equivalent for echo? or anything similar to print mulitple lines without need of putting backslashes before code in HTML for echo <a href=\"blah.com\">.

    TIA.

    Ya you can make a variable assignment like so... (Heredoc)

    PHP Code:
    <?php

    $header 
    = <<<MESSAGE_HEADER
    ++++++++++++++++ MESSAGE ++++++++++++++++


    MESSAGE_HEADER;

    echo 
    $header;

    ?>

    Or just echo it...

    PHP Code:
    <?php

    echo <<<MESSAGE_HEADER
    ++++++++++++++++ MESSAGE ++++++++++++++++


    MESSAGE_HEADER;


    ?>

    More info here


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
  •