0

PHP not recognized between DOM elements

I feel like the answer to this must be obvious, but given the frequency of the words used to describe the issue, I'm having a hard time searching for a resolution to this.

Basically, when I have code such as this:

<div >
<?php
if ($a = 'b'):
...
endif;
?>
</div>

All of the PHP that is within DOM nodes isn't recognized as PHP. PHPStorm thinks that it's HTML, despite the fact that it's enclosed in PHP tags.

PHP within the HTML tag itself, such as this:

<div ></div>

works just fine. Only PHP between the opening and closing HTML tags causes a problem.

Any ideas?

6 comments

Please sign in to leave a comment.