3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', 1); //$a = print_r(var_dump($GLOBALS),1); //echo htmlspecialchars($a); $servername = "#"; $username = "#"; $password = "#"; $dbname = "#"; // Create connection //$conn = mysqli_connect($servername, $username, $password, $dbname); //echo "Connection Successful : "; // Check connection //if (!$conn) { // die("Connection failed: " . mysqli_connect_error()); //} // Read JSON file //$jsondata = file_get_contents('scripts/AUDIT_DIR/report.json'); //echo "JSON File Read : "; // Convert and Loop //$item = json_decode($jsondata, true); $item = null; echo "JSON File Decoded : "; foreach($item as $arr) { $id = $arr["id"]; $hostname = $arr["hostname"]; $ip = $arr["ip"]; $package = $arr["package"]; $publisher = $arr["publisher"]; $origin = $arr["origin"]; $version = $arr["version"]; $size = $arr["size"]; //$sql = "INSERT INTO testtable(id, hostname, ip, package, publisher, origin, version, size) //VALUES ('10', '$hostname', '$ip', '$package', '$publisher', '$origin', '$version', '$size')"; if (mysqli_query($conn, $sql)) { echo "New record created successfully : "; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } }
Output for git.master, git.master_jit, rfc.property-hooks
JSON File Decoded : Warning: foreach() argument must be of type array|object, null given in /in/oNr8P on line 31

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:
119.23 ms | 405 KiB | 5 Q