Free Online PHP Playground
Write PHP code and run it, with the output shown in a console. Your code is sent to a free online service to be run.
Press Run, or Ctrl or Cmd + Enter, to run your code. The output is shown in Console. PHP runs on a remote server, so it needs a connection, can be busy, and can take a few seconds to answer. It stops after 90 seconds. Input is not available.
Preview
Console
Output appears here. Press Run, then try console.log("Hello")
As with any online tool, we highly recommend not including sensitive data in your code, such as passwords, API keys or other secrets.
How to use
Write your script in main.php, starting with the <?php tag.
Press Run, or Ctrl or Cmd + Enter. The output appears in the Console panel.
Print what you want to see with echo, print_r or var_dump.
Put sample data in the script, because it cannot read keyboard input or receive a web request.
Download a zip with your script and a page that records the last output.
Why use this tool
A recent PHP release
The newest released PHP version the service lists is chosen at each run. The example prints PHP_VERSION so you can see it.
Command-line PHP
Output is shown as plain text, which suits testing functions, classes and string or array handling.
Starter script
The example shows enums, constructor property promotion, array functions and json_encode.
About this tool
Run a PHP script online without setting up a web server or installing PHP. The editor opens with an example that declares strict types, uses a backed enum and a class with read-only properties, filters an array with an arrow function and prints JSON. PHP cannot run inside this page, so when you press Run your script is sent to a free online code-running service, which runs it on the command line and returns what it prints. Never paste passwords, API keys or other secrets.
Frequently asked questions
Yes. When you press Run, your code is sent from your browser to Wandbox (wandbox.org), a free community service that runs it and sends back the output. Like any website, it also receives your IP address. Do not include passwords, API keys, private data or other secrets.
No. The script runs from the command line, and its output is shown as text, tags included. To see markup drawn, paste the output into the HTML Playground.
There is no web request behind the script, so no form data or query string arrives. Fill an array with sample values in your code instead.
No packages can be installed, and no database is set up for you. Use arrays or sample strings to test your logic.
Usually a few seconds. The playground stops waiting after 90 seconds, and a busy or unreachable service gives a message so that you can try again.