Writing PHP code in JS will definitely report an error, but writing it in HTML will not.
Or if you feel uncomfortable, you can directly lower the error level.
Move the pointer to None and there will be no error.
Make sure:
When writing PHP code in HTML, your file extension should end with.php
to be recognized!