XmisterIS
04-27-2012, 09:47 AM
I've been coding PHP for a while and just now I've come across some new string notation here: http://php.net/manual/en/domdocument.loadxml.php
For example:
$str = <<<XML
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE root [
<!ENTITY nbsp "*">
]>
<div>This is a non-breaking space.</div>
XML;
What's with the <<<XML .... XML; notation? How is it different, functionally, to quoting the markup in a string?
EDIT: Ha ha ha! I've just tried using that notation in some code and it just gives me a syntax error! Works fine with quotes though.
For example:
$str = <<<XML
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE root [
<!ENTITY nbsp "*">
]>
<div>This is a non-breaking space.</div>
XML;
What's with the <<<XML .... XML; notation? How is it different, functionally, to quoting the markup in a string?
EDIT: Ha ha ha! I've just tried using that notation in some code and it just gives me a syntax error! Works fine with quotes though.