Online PHP Compiler

About this PHP compiler

This free online PHP compiler lets you write and run PHP scripts in your browser. Use it to test functions, arrays, loops and string handling, or to check a short script before you add it to a project.

How to use the online PHP compiler

  1. Write or paste your PHP code in the editor. Sample code is already loaded.
  2. Click Run.
  3. Read the result in the black panel. Errors from your code appear there too.

PHP compiler FAQs

Do I need the opening PHP tag?

Yes. Start your script with <?php. Anything outside the PHP tags is printed as plain text.

How do I print output in PHP?

Use echo or print. To inspect a variable, use var_dump() or print_r().

Where does the code run?

On a remote server. The output is shown next to the editor, and nothing is installed on your computer.

Learn PHP

Want to go beyond the basics? Follow our step-by-step PHP tutorial.

Other online compilers