3v4l.org

run code in 300+ PHP versions simultaneously
<?php include_once 'dbconfig.php'; $method = $_SERVER['REQUEST_METHOD']; switch($method) { case 'POST': $data = json_decode($_POST['params']); $name = $data['name']; $sql_query = "INSERT INTO person(name) VALUES('$name')"; $result = mysqli_query($link, $sql_query); break; case 'GET': $uriParts = spliti ("/", $_SERVER['REQUEST_URI']); $id = end($uriParts); $sql_query="SELECT * FROM person WHERE id=".$id; $result_set=mysqli_query($link, $sql_query); $rows = array(); while($r = mysqli_fetch_assoc($result_set)) { $rows[] = $r; } break; } header('Content-type: application/json'); echo json_encode($rows);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: include_once(): open_basedir restriction in effect. File(dbconfig.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/rvn2F on line 2 Warning: include_once(dbconfig.php): Failed to open stream: Operation not permitted in /in/rvn2F on line 2 Warning: include_once(): Failed opening 'dbconfig.php' for inclusion (include_path='.:') in /in/rvn2F on line 2 Warning: Undefined array key "REQUEST_METHOD" in /in/rvn2F on line 4 Warning: Cannot modify header information - headers already sent by (output started at /in/rvn2F:2) in /in/rvn2F on line 26 Warning: Undefined variable $rows in /in/rvn2F on line 27 null

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
59.68 ms | 402 KiB | 8 Q