3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once '../dbconfig.php'; if (isset($_POST)) { $post_id = $_POST["id"]; $title = trim($_POST['title']); $post_link = str_replace(" ", "_", strtolower(trim($_POST['title']))); $img = $_POST['img']; $text = trim($_POST['text']); $chords = trim($_POST['chords']); $SC = trim($_POST["linkSC"]); $poster = trim($_SESSION["user_name"]); $dt = date('Y-m-d H:i:s'); $isupdated = 1; $links = json_decode($_POST["links"], true); try { $stmt = $db_con->prepare("UPDATE `PJW_posts` SET title=?, post_link=?, img=?,text=?, sc_link=?, chords=?, updated_by=?, updatetime=?, is_updated=? WHERE id=?"); if ($stmt->execute(array($title, $post_link, $img, $chords, $SC, $chords, $poster, $dt, $isupdated, $post_id))) { echo json_encode(["status" => 200]); exit; } else { echo json_encode(["status" => 422, "error" => "Database error."]); } } catch (PDOException $e) { echo json_encode(["status" => $e->getCode(), "error" => $e->getMessage()]); } }
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: require_once(): open_basedir restriction in effect. File(../dbconfig.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/UvAhd on line 3 Warning: require_once(../dbconfig.php): Failed to open stream: Operation not permitted in /in/UvAhd on line 3 Fatal error: Uncaught Error: Failed opening required '../dbconfig.php' (include_path='.:') in /in/UvAhd:3 Stack trace: #0 {main} thrown in /in/UvAhd on line 3
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: require_once(): open_basedir restriction in effect. File(../dbconfig.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/UvAhd on line 3 Warning: require_once(../dbconfig.php): Failed to open stream: Operation not permitted in /in/UvAhd on line 3 Fatal error: Uncaught Error: Failed opening required '../dbconfig.php' (include_path='.:') in /in/UvAhd:3 Stack trace: #0 {main} thrown in /in/UvAhd on line 3
Process exited with code 255.
Output for 8.0.13
Warning: require_once(../dbconfig.php): Failed to open stream: No such file or directory in /in/UvAhd on line 3 Fatal error: Uncaught Error: Failed opening required '../dbconfig.php' (include_path='.:') in /in/UvAhd:3 Stack trace: #0 {main} thrown in /in/UvAhd on line 3
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
Warning: require_once(../dbconfig.php): failed to open stream: No such file or directory in /in/UvAhd on line 3 Fatal error: require_once(): Failed opening required '../dbconfig.php' (include_path='.:') in /in/UvAhd on line 3
Process exited with code 255.
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
Warning: require_once(): open_basedir restriction in effect. File(../dbconfig.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/UvAhd on line 3 Warning: require_once(../dbconfig.php): failed to open stream: Operation not permitted in /in/UvAhd on line 3 Fatal error: require_once(): Failed opening required '../dbconfig.php' (include_path='.:') in /in/UvAhd on line 3
Process exited with code 255.

preferences:
241.6 ms | 403 KiB | 287 Q