You can make a tool like w3schools that run right after your click on the run button. Logic is very simple and anyone can make it. Just write a code that get all what he writes in php and make a file on the run time with the php extension and run it with the localhost link and it will be ready to run. Here is the code below.
Make directory extactly same as “http://localhost/histpk/createOutput” and make CreateOutput.php and then paste the code below.
Code:
<?php ini_set('display_errors', 0); error_reporting(E_ERROR | E_WARNING | E_PARSE); ?><centeR><table border="1"><tr><td align="center" colspan="2"><form action="#" method="post"> <select name="language"> <option value="html">HTML</option> <option value="php">PHP</option> </select></td></tr><br><tr><td> <textarea cols="25" rows="25" name="code" value=""></textarea></td> <td> <?php //echo getcwd(); if(isset($_POST['sbt1']) && ($_POST['language']) == "php" ) { //echo "hello"; $code = $_POST['code']; $myfile = fopen("testfile1.php", "w"); $write_file = fwrite($myfile , "$code"); } if(isset($_POST['sbt1']) && ($_POST['language']) == "html" ) { //echo "hello"; $code = $_POST['code']; $myfile = fopen("testfile1.html", "w"); $write_file = fwrite($myfile , "$code"); } ?> <textarea cols="25" rows="25" name="result" value=""> <?php if(isset($_POST['sbt1']) && ($_POST['language']) == "php" ) { $d = fopen("http://localhost/histpk/createOutput/testfile1.php" , "r"); while ($a = fgetss($d)) { echo $a; }} if(isset($_POST['sbt1']) && ($_POST['language']) == "html" ) { $d = fopen("http://localhost/histpk/createOutput/testfile1.html" , "r"); while ($a = fgetss($d)) { echo $a; } } ?></textarea></td><tr><td align="center" colspan="2"> <input type="submit" name="sbt1"></td></tr> </form></table>