Dynamic Php Executor
Working on a PHP project currently, I found myself doing the same thing again and again. Whenever I needed some test output of some PHP code, I opened a new PHP file in my code editor, added some lines of code, thinking of a filename and save it. Then I open up the browser and tried to remember the filename again to run the script via my localhost.
This became boring after a while so I searched the web for a solution to execute PHP code dynamically on the fly. Unfortunately, I did not find any good solution that’s why I started this little project. I named it Dynamic PHP Executor.
What is it about ?
It’s a little PHP page that allows you to enter PHP code and execute it directly on the fly. This way you can test little PHP snippets without saving them to disc.
The Dynamic PHP Executor comes in a single file, ie. it does need not any additional include files.
A quick note to CSS/Javascript/HTML designers
In general, I know that this is not a good habbit to put CSS styles, javascript code et cetera into a single file. However in this case, it helps to keep this project small and compact.
How does it work ?
The core functionality consists of one PHP line only actually
eval(stripslashes($_POST['phpCode']));
So, the request data contains the PHP code. This is evaluated. The function stripslahes is required since all quotations are escaped when posted. Here is screenshot of how it looks in action.

Be careful though!
Only use this script in a secure environment. The user of the tool can run any PHP code he wants on your machine. Please keep this in mind and read the disclaimer inside the file.
Try it
Download the source, read the disclaimer and comments inside the file. Then simply run it through a PHP enabled web server.
Name: Dynamic Php Executor
Size: 2.58 KB
Hits: 306
