Is there a JSFiddle for PHP ? Yes !
It’s awesome how UNknown these little and extremely powerful tools are: There are some online tools that let you paste in (or write) PHP code and run it, exactly like JSFiddle (and similar) do. Perfect for testing out small scripts when not having access to real development environment. However, some things will not work (like access to the shell or long-running scripts), but in general you are getting a full PHP interpreter here.
The quick & useful ones:
viper-7 is my choice! Always up to date, and let’s you choose the PHP version (5.2.x, 5.3.x, 5.4.x, 5.5.x and even the latest trunk !). Excellent! IDEone and onlinephpfunctions provide similar possibilities, but don’t have the latest PHP versions available.
The big & bloated, but extremely powerful one: phpfiddle.org
Let’s you load libraries, drivers, dependencies, run SQL statements, has GitHub/Gist integration, let’s you save everything in your dropbox, run PSR sniffers (and others) over your code and much much more… This is a beast.
The bad ones (do not use!):
phpresult.com & codepad.org
This is usually the answer when people ask for “online php” or “jsfiddle for php”. And codepad.org is just one thing: old ! The PHP version is extremely outdated (PHP 5.2), there are no useful features and in general everything is public, you can even sit there and watch the incoming stream of code people paste in. Well, it had its time, but trying out code in PHP 5.2 makes absolutely no sense, so please dismiss this tool. phpresult.com looks good at first, but is not even able to put out the used php version in any way. Beside that, everything around the project looks like spam. So, it’s also not a useful choice.