TCM
TCM

Reputation: 16900

Multi line variable not getting created

What is the problem with this following code?

class EMAIL_BODY{
   public $REGISTRATION = <<<EOF
        <html>
                <head>
                </head>
                <body style='font-family: helvetica;'>
                        Welcome <b>#{FIRST}</b>, <br/> You have successfully created your account.
                        However, there is one more step that you need to take to verify your account.
                        Please click the below given link to activate your account.
                        Unless you do that your account won\'t get activated. <br/>

                        <a> #{LINK} </a>

                </body>
        </html>

    EOF;

}

Upvotes: 1

Views: 93

Answers (1)

Gumbo
Gumbo

Reputation: 655519

You must put the closing delimiter of your heredoc EOF; right at the start of the line:

It is very important to note that the line with the closing identifier must contain no other characters, except possibly a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs before or after the semicolon.

So:

class EMAIL_BODY{
   public $REGISTRATION = <<<EOF
        …
EOF;
}

Upvotes: 3

Related Questions