Input PHP
Paste your code to format it and check its syntax
Options
Adjust formatting and validate
Detect the format on paste. If ambiguous, choose it manually.
Result
Code viewer · Read only
Format and validate PHP online
Format PHP code including its opening <?php or <?= tag. Check syntax without executing code or connecting to your server. Validation does not check dependencies, types or runtime errors.
How to use the formatter
- Paste your code in the editor. JSON is the default format on the home page.
- Enable detection on paste or choose the format manually. HTML and XML can be ambiguous.
- Adjust indentation and select Format or Validate. The viewer includes syntax colors and folding for every format. Minification is available for JSON.
Code example PHP
<?php
function greet($name){return "Hello " . $name;}
echo greet("Ada");
Is my code sent to a server?
No. Processing takes place in your browser. Pasted code is neither uploaded nor stored on the server.
What does validation check?
It checks syntax with the selected format’s parser. It does not execute code or guarantee that a program works correctly. If there is an error, fix the input and validate again.