0

I am new in learning PHP and even in coding overall. Please see the code below and parse it in your browser

<?php
echo "<h3> Below is an examples of Heredoc Syntax in PHP<h3>";
$foo = <<<XYZ
This is a string using heredoc syntax.
XYZ;
    echo $foo;
?>

Whey the string stored in $foo inherits the properties of h3 tag above when parsed in a browser? Should it not return plain text? Help please.

4

2 回答 2

1

You didn't close the first <h3> tag properly. Instead you're starting a new one. So in actuality you have two h3 elements, neither with a closing tag...

If you close it correctly, it should work as expected:

echo "<h3> Below is an examples of Heredoc Syntax in PHP</h3>";
于 2012-08-09T06:35:12.990 回答
0

你需要关闭<h3> </h3>标签..而不是你再次打开它

于 2012-08-09T06:36:19.917 回答