PHP`-l`标志没有找到错误

Why might the PHP -l switch not find errors in test.html.

$ cat test.html 
<?php
error_reporting(E_ALL);
echo "Hello, world!";

sdfsdfsdfsdf

?>
$ php -dhtml_errors=0 -ddisplay_errors=On -l test.html 
No syntax errors detected in test.html
$ php test.html 
Hello, world!PHP Notice:  Use of undefined constant sdfsdfsdfsdf - assumed 'sdfsdfsdfsdf' in test.html on line 7
$ 

Other types of errors are also not found, such as undefined functions, require_once() to nonexistant files, incorrect syntax in array declarations, etc. Why might this be?

Thanks.

-l Syntax check only (lint)

-l performs a static syntax check. The code is never actually executed. And in your code there are no syntax errors.

The gibberish at the end of your file is considered a constant (since it's a valid name for a constant) and undefined constants evaluate to their string representation (and cause an E_NOTICE). Since it's the last statement in the file the missing semicolon also does not result in a syntax error.

Since PHP is a dynamic language an undefined constant cannot be detected without executing the code - define() is just a normal function after all.

These are not syntax error, these are runtime errors. -l only lints the file.