A
A
Alexander2018-03-16 21:30:09
PHP
Alexander, 2018-03-16 21:30:09

How to format php + html code?

There are many thousands of lines of code in which php and html are mixed:

<?php
if (1) :
?>
    <div class="">test
    </div>
<?php
  echo "test";
endif;
?>

Also mixed space and tab, line breaks and brackets.
How can you automate the process of bringing the whole hodgepodge to a single style?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Nesmeyanov, 2018-03-16
@noobwpjs

mixed php and htm

Better option: Ctrl+A -> Delete
A slightly worse option, but also nothing: PhpStorm -> Ctrl+Shift+Alt+L -> Enter

N
Nikita Gureenkov, 2021-05-07
@Gureenkov56

I work in VS Code with WordPress, where PHP is tightly mixed with HTML.
The PHP Intelephense plugin seems to do the trick. I am satisfied.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question