I have inherited a website for which I need to make some changes. As always there are many ways to do things in website development. However, this particular site has me confused. All the html is delivered via heredoc php scripts. However, none do any php processing.
For example (structure only) index.php:
<?php
$html = <<<html
<html>
<head></head>
<body>
{more simple HTML here. No php processing to be done}
</body>
</html>
html;
echo $html;
?>
I understand the php but I can’t figure out why they generate the page this way as oppose to simply deliver it without the php variable processing. Before I just assume the person had no idea what they were doing I thought I’d ask. Any ideas?
This is my first post to StackOverflow so feedback on forum etiquette also welcome.
It might be because they intended to use PHP variables within the HEREDOC. Your example doesn’t have those, but I would hazard a guess that they are used in places. From there, I would then just imagine HEREDOC used everywhere for consistency.