Unsupported: Html

In PHP, it is not uncommon to see PHP and HTML intermixed in the same file.

<head></head>
<body>
Hello, today is <?php echo date('l, F jS, Y'); ?>.
</body>
</html>
Output
<head></head>
<body>
Hello, today is Thursday, November 12th, 2015.
</body>
</html>

The above PHP code will run just fine in HHVM. At the command line, the output will be the raw HTML with the proper date included.

No Typechecking, Runtime Errors

The problem becomes when you try to replace <?php with <?hh.

<head></head>
<body>
Hello, today is <?hh echo date('l, F jS, Y'); ?>.
</body>
</html>
Output
Fatal error: HH mode: content before <?hh (Line: 3, Char: 16)
syntax error, unexpected T_HH_ERROR, expecting $end in /data/users/joelm/user-documentation/guides/hack/60-unsupported/04-html-examples/html-hack.php on line 1

And the problem is confusing. The typechecker will basically throw its hands up and give you "No Errors!", no matter what you put after the <?hh, even in strict mode. That's great, right? Nope. The typechecker doesn't even understand this type of file and, on top of that, this code won't even run in HHVM. You will get a fatal error complaining that there is unknown content before the <?hh tag.

In Hack, <?hh must always be the first 4 characters seen.

Use XHP

If you really want to mix HTML-like elements with your Hack code, XHP was made especially for that. And, it is typecheckable.