
Originally Posted by
marain
... But I still do not understand why
echo "<br /><br /><div align='right'>";
drops data.
I had suspected that, perhaps, it was not dropping the data - rather, the browser was removing/"correcting" it for some reason. It happens sometimes, especially if your page is being rendered in quirks mode for some reason.
If you're using ->view source, however, then that should be the actual PHP output...
Could you post your entire script, and maybe a link to the output page?

Originally Posted by
marain
first mastering the basic rules of the language, and then exploring optimization and elegance.
Of course.
If you want to avoid the HEREDOC, basic concatenation will produce exactly the same string:
PHP Code:
$output = '<div>'.$quotations[4].'<div style="text-align: right; margin: 1em 0;">'.$quotations[5].'</div></div>The PHP End';
However, I would still recommend not using echo (print, ?>, etc.) until _everything_ is ready to be output.
IMO, it's not "optimization" or "elegance" or an "advanced technique" - it's a very important basic concept that is consistently overlooked and/or taught wrong in the name of simplicity.
Bookmarks