Skip to content
UniKit

PHP minifier

Beautify and minify PHP: `//`, `#` and `/* */` are all recognised as comments, while strings and HTML outside `<?php ?>` stay verbatim; only PHP code segments are re-flowed.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

PHP source

Result

The result can be copied directly.

Enter PHP to see the result

Characters: 0 · Lines: 0

What this tool does

  • Tidy PHP interleaved with HTML into readable structure.
  • Minify PHP before shipping by dropping comments and padding.
  • Verify that `//` inside a string is not treated as a comment.

Example

Input

<?php
$s = "a  b"; // c
?>

Output

<?php
$s = "a  b";
// c
?>

HTML outside `<?php ?>` and PHP strings are kept verbatim; only PHP code segments are re-flowed.

Frequently asked questions

Are both `//` and `#` comments in PHP?

Both are recognised as line comments; `//`, `#` and `/* */` inside strings are untouched because the lexer excludes them.

Does it execute PHP?

No. It only re-flows text — nothing is interpreted or executed, and the input never leaves the browser.

What about `<?= ?>` short tags?

Supported: short tags are treated as code segments like `<?php ?>`.

Heredoc / nowdoc?

Their bodies are kept as multi-line strings (starting with `<<<`) and are not re-indented.

Keywords:php minifierformatconverterdeveloper

Related tools