php.onl documentation
Everything you need to get productive with php.onl. It is a no-signup, in-browser PHP playground — there is nothing to install.
Quick start
- Open the playground.
- Type or paste PHP into the editor (the default snippet runs as-is).
- Press Run — your code executes in the browser and the output appears in the results panel.
That is the whole loop. No account, no server round-trip.
Keyboard shortcuts
- Run code:
Ctrl + Enter(on Windows/Linux) or⌘ + Enter(on macOS).
The Run button doubles as a Stop button while a script is executing — click it again, or it stops automatically at the wall-clock timeout, so a runaway loop can never hang the page.
Choosing PHP versions
Open the version selector in the toolbar and tick one or more versions (7.2 through 8.5). The first time you use a version, php.onl downloads its WebAssembly runtime (shown with a real progress bar); after that it is cached and loads instantly, even offline. See all releases on the versions page.
Running multiple versions at once
Select several versions and a single Run executes your snippet on all of them in parallel. The results panel shows each version's output together and highlights where they differ — ideal for spotting deprecations and behaviour changes. There is a deep-dive in Test PHP deprecations across versions.
STDIN and command-line arguments
Open the input panel to provide:
- STDIN — text piped to your script, readable via
php://stdin,fgets(STDIN), orfile_get_contents('php://stdin'). - Arguments — command-line arguments available in
$argv(and counted by$argc).
This lets you test scripts that behave like real CLI tools.
Sharing a snippet
Click Share to get a link. The code — along with the selected versions, STDIN, and arguments — is compressed and encoded into the URL hash itself, so nothing is stored on a server. Anyone who opens the link reconstructs the exact snippet locally. Very large snippets make for very long URLs; for those, keep the code trimmed.
Embedding a runnable snippet
The Share dialog also gives you an <iframe> snippet that embeds a read-only runner in your own page, docs, or article:
<iframe src="https://php.onl/embed?theme=light&run=1#<token>"
width="100%" height="420" frameborder="0"
title="php.onl snippet"></iframe>The embed view supports ?theme=light or ?theme=dark, and ?run=1 to auto-run the snippet on load. The embed route is intentionally read-only and not indexed by search engines.
Offline use
php.onl is an installable Progressive Web App. After the first load, the app shell and any downloaded runtimes are cached, so it works with no connection. Install it from your browser's "Install app" / "Add to Home Screen" option to launch it like a native tool.
Have what you need? Open the playground →