note 86365 deleted from language.types.string by cmb

From: Date: Sun, 04 Aug 2019 09:06:04 +0000
Subject: note 86365 deleted from language.types.string by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-211788@lists.php.net to get a copy of this message
Note Submitter: Salil Kothadia ---- An interesting finding about Heredoc "syntax error, unexpected $end". I got this error because I did not use the php close tag "?>" and I had no code after the heredoc code. foo1.php code gives "syntax error, unexpected $end". But in foo2.php and foo3.php, when you add a php close tag or when you have some more code after heredoc it works fine. Example Code: foo1.php 1. <?php 2. $str = <<<EOD 3. Example of string 4. spanning multiple lines 5. using heredoc syntax. 6. EOD; 7. foo2.php 1. <?php 2. $str = <<<EOD 3. Example of string 4. spanning multiple lines 5. using heredoc syntax. 6. EOD; 7. 8. echo $str; 9. foo3.php 1. <?php 2. $str = <<<EOD 3. Example of string 4. spanning multiple lines 5. using heredoc syntax. 6. EOD; 7. ?>

« previous php.notes (#211788) next »