Online PHP compiler
Run PHP code online free, no sign-up: write a PHP script, give it input on STDIN and see the output, errors and run time in your browser.
How do I run PHP code online?
This is an online PHP compiler and interpreter for the command line: write a script, put its input in the Input box and press Run, and you see what it echoed, any error or warning PHP raised, and the run time — free, with no sign-up.
How it works
- Write your program. Start the file with <?php — anything before that tag is printed as it stands. The script runs from the command line, so there is no web server: no $_GET, $_POST or HTML page, just text written with echo.
- Give it input. fgets(STDIN) reads one line (newline included — wrap it in trim()), stream_get_contents(STDIN) reads everything, and fscanf(STDIN, "%d %d", $a, $b) reads formatted values. explode(" ", $line) splits a line into parts. Put every line the program reads in the Input box before you run it.
- Run it. Press Run or Ctrl+Enter. You get what the program printed, any compiler or runtime error, and how long it ran. The first run without an account asks a quick check that you are a person.
Who it is for
Anyone writing PHP who wants it run now: a student checking a lab program or an exam answer, someone on a machine where nothing can be installed, or a learner trying PHP before setting it up.