PHP Code Formatter
Format PHP source for a selected PHP version in your browser.
This page formats PHP source with the Prettier PHP plugin in your browser. Select the PHP version that matches the source before formatting it. Available profiles include PHP 5.0 through 5.4, PHP 5.6, PHP 7.0 through 7.4, and PHP 8.0 through 8.1.
Formatting changes whitespace, indentation, and line breaks. It does not execute the PHP code or prove that the program behaves correctly.
- Paste PHP source into the input editor.
- Select the PHP version used by the project.
- Select Format.
- Review and copy the output.
The formatter can reject syntax that is invalid for the selected PHP version. A successful format means the parser accepted the source. Run the project's tests and review the change before replacing a working file.
Read HTML, Markdown, and Text Conversion Workflows That Preserve Meaning for markup and content-conversion tasks.