Programming Languages

PHP Playground

Real PHP 8 in the browser - functions, classes, OOP, JSON.

Runtime: php-wasm (PHP 8 in WebAssembly)

First run downloads ~5 MB of PHP WASM; subsequent runs are instant.

About this playground

PHP 8 compiled to WebAssembly via the php-wasm project. Real PHP - same parser, same engine, same stdlib functions as on a server. The runtime lazy-loads (~5 MB) only when you open this page. Useful for testing snippets without spinning up a LAMP stack. Output of echo / print / print_r is captured into the panel below the editor.

FAQs

Real PHP, not a translator?

Yes - php-wasm compiles the actual PHP source via Emscripten. array_map, json_encode, preg_match, DateTime and the OO syntax all behave as on a server.

How big is the download?

About 5 MB compressed, fetched only when you open this page. After the first load, the WASM stays cached for subsequent runs.

What about extensions like MySQLi or cURL?

Built-in extensions (date, json, mbstring, hash, openssl, simplexml, pcre) work. Network extensions like MySQLi, cURL or sockets need a real server - they're not available.

Why does the first run take a few seconds?

The browser needs to fetch and instantiate ~5 MB of WebAssembly the first time. Subsequent runs reuse the already-loaded interpreter and are near-instant.

Other playgrounds