PHP Playground

    Loading playground...

    Run PHP code online, free

    Write and run PHP 8.3 code from your browser. There is nothing to install and no account: type your code and press Run, or Ctrl+Enter.

    When you press Run, your code is sent to Wandbox, a free online compiler service, which runs it and sends back the output. Unlike Python, which runs on your device, PHP code leaves your browser, so do not include passwords or other secrets.

    Giving your script input

    Use the stdin box
    Read input with fgets(STDIN). Whatever you type into the stdin box above the editor is passed to your script when you press Run.
    See errors clearly
    Parse errors and warnings appear in the terminal with their line numbers.

    How to run PHP code online

    1. Write or paste your script, starting with <?php.
    2. If it reads input, type it into the stdin box.
    3. Press Run and read the output in the terminal.

    Frequently asked questions

    Which PHP version is used?

    PHP 8.3, run through the Wandbox online compiler service.

    Is my PHP code private?

    Your code is sent to Wandbox to be run. Do not include passwords, keys or other secrets in it.

    Can I use a web server or a database?

    No. Scripts run from the command line, so there is no web server, database or browser output.

    Where can I find PHP examples?

    The PHP examples cover basics, strings, arrays, control flow and functions.