Write PHP in the editor above, press Run, and read the output below it. Under the hood this is a real PHP interpreter compiled to WebAssembly, executing on your machine — not an emulator, not a mock, and not a server somewhere receiving your code. The first run downloads the engine (about 10 MB); after that it stays cached and every run starts instantly.
How to run PHP online here
The workflow is deliberately small. Type or paste your program — <?php tags and all, exactly like a .php file — and press Run or hit Ctrl/Cmd + Enter. Output printed with echo and printf appears in the output panel, and PHP diagnostics — warnings, notices, and full fatal-error traces with line numbers — show up right where they happened. Code that mixes HTML and PHP works the way you expect: everything outside the <?php ?> tags is printed as-is.
If a program runs longer than you intended, press Stop. Stopping discards the current interpreter — the next run builds a fresh one, which is also why a crashed program can never poison the one after it. In fact, every run already starts from a clean interpreter state: variables, functions, and classes from your previous run never leak into the next one, so re-running the same script twice behaves exactly like loading the page fresh.
Reading input with fgets(STDIN)
The STDIN, STDOUT, and STDERR constants are defined for you, so classic stdin-driven programs work unchanged. Open Program input (stdin) below the output panel and put one line per read. Running the Reading input example with Alex and 3 in the input box produces a real conversation:
What is your name? Alex
How many years have you coded? 3
Nice to meet you, Alex!
In another 3 years you will have coded for 6 years.
When the input box runs out of lines, further reads return an empty string — the same behavior as piping a short file into php on the command line, which makes it easy to practice the classic exercise formats without pretending to type into a frozen console.
Which PHP is this, exactly?
The engine is php-wasm — PHP compiled to WebAssembly — and the Version selector in the toolbar offers real builds of PHP 8.0, 8.1, 8.2, 8.3, 8.4, and 8.5. Switching versions swaps in the matching interpreter build, and the badge in the status bar shows the exact patch version after the engine loads. Language semantics are the ones you know: the same syntax, the same standard library, the same everything, with only filesystem and OS-specific corners adapted to the browser sandbox.
The honest limits: web-specific features are outside the model. There is no web server, so $_GET and $_SESSION behave like empty request data, and extensions that depend on native libraries aren’t compiled in. For everything else — practicing arrays and strings, testing a small class design, trying PHP 8 enums and readonly properties, verifying a foreach — it behaves like the PHP you know.
Your code stays on your device
The program you write is executed by your own browser and saved only in your browser’s local storage, so closing the tab and coming back later restores your last edit. The share button packs the current code (and stdin and PHP version) into the link itself — the URL fragment is never sent to any server, and people you share it with see exactly what you wrote. Import opens a .php file from your computer straight into the editor, Download saves the current code as main.php, and Copy puts it on your clipboard. There is no account, no history on our side, and nothing to delete later.
Frequently asked questions
Can I run PHP 8 here? Yes — pick any version from 8.0 to 8.5 in the toolbar. The badge shows the exact patch release, like PHP 8.4.1.
Do I need the <?php tag? Convention says yes, and error line numbers stay exact with it. If you forget it entirely, the runner adds it for you before executing.
Is my code uploaded anywhere? No. Execution happens in your browser via WebAssembly. Code is saved locally and shared only through links you create yourself.
Does it work offline? After the engine has loaded, you can disconnect and keep running code. A fresh page load needs the network once to fetch the engine again.
Can I use it on a phone? Yes. The editor, input box, and output stack vertically on small screens, and the console text scales with your system font settings.
Why is the first run slower? That is the one-time interpreter download. Every run after it skips the download entirely.