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); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 46
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 46
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
filename:       /in/oNr8P
function name:  (null)
number of ops:  48
compiled vars:  !0 = $servername, !1 = $username, !2 = $password, !3 = $dbname, !4 = $item, !5 = $arr, !6 = $id, !7 = $hostname, !8 = $ip, !9 = $package, !10 = $publisher, !11 = $origin, !12 = $version, !13 = $size, !14 = $conn, !15 = $sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'ini_set'
          4        SEND_VAL                                                 'display_errors'
          5        SEND_VAL                                                 1
          6        DO_ICALL                                                 
    8     7        ASSIGN                                                   !0, '%23'
    9     8        ASSIGN                                                   !1, '%23'
   10     9        ASSIGN                                                   !2, '%23'
   11    10        ASSIGN                                                   !3, '%23'
   28    11        ASSIGN                                                   !4, null
   29    12        ECHO                                                     'JSON+File+Decoded+%3A+'
   31    13      > FE_RESET_R                                       $23     !4, ->46
         14    > > FE_FETCH_R                                               $23, !5, ->46
   33    15    >   FETCH_DIM_R                                      ~24     !5, 'id'
         16        ASSIGN                                                   !6, ~24
   34    17        FETCH_DIM_R                                      ~26     !5, 'hostname'
         18        ASSIGN                                                   !7, ~26
   35    19        FETCH_DIM_R                                      ~28     !5, 'ip'
         20        ASSIGN                                                   !8, ~28
   36    21        FETCH_DIM_R                                      ~30     !5, 'package'
         22        ASSIGN                                                   !9, ~30
   37    23        FETCH_DIM_R                                      ~32     !5, 'publisher'
         24        ASSIGN                                                   !10, ~32
   38    25        FETCH_DIM_R                                      ~34     !5, 'origin'
         26        ASSIGN                                                   !11, ~34
   39    27        FETCH_DIM_R                                      ~36     !5, 'version'
         28        ASSIGN                                                   !12, ~36
   40    29        FETCH_DIM_R                                      ~38     !5, 'size'
         30        ASSIGN                                                   !13, ~38
   45    31        INIT_FCALL_BY_NAME                                       'mysqli_query'
         32        SEND_VAR_EX                                              !14
         33        SEND_VAR_EX                                              !15
         34        DO_FCALL                                      0  $40     
         35      > JMPZ                                                     $40, ->38
   47    36    >   ECHO                                                     'New+record+created+successfully+%3A+'
   45    37      > JMP                                                      ->45
   51    38    >   CONCAT                                           ~41     'Error%3A+', !15
         39        CONCAT                                           ~42     ~41, '%3Cbr%3E'
         40        INIT_FCALL_BY_NAME                                       'mysqli_error'
         41        SEND_VAR_EX                                              !14
         42        DO_FCALL                                      0  $43     
         43        CONCAT                                           ~44     ~42, $43
         44        ECHO                                                     ~44
   31    45    > > JMP                                                      ->14
         46    >   FE_FREE                                                  $23
   53    47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.82 ms | 1008 KiB | 15 Q