3v4l.org

run code in 300+ PHP versions simultaneously
<?php $server = "oniddb.cws.oregonstate.edu"; $username = "mcaliste-db"; $database = "mcaliste-db"; $mysqli = new mysqli($server, $username, $password, $database); if (!$mysqli || $mysqli->connect_errno) { echo "Connection error " .$mysqli->connect_errno ." ".$mysqli->connect_error; } else { echo "Connection successful<br>"; } // table name and attributes: // CREATE TABLE userinfo (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, // gender VARCHAR(6) NOT NULL, age INT NOT NULL, PRIMARY KEY (id) ); if(!empty($_REQUEST)){ //unset($err); $name = htmlspecialchars($_REQUEST['name']); $gender = htmlspecialchars($_REQUEST['sex']); $age = htmlspecialchars($_REQUEST['age']); //$name = 'Bob'; //$gender = 'male'; //$age = 45; if (!($stmt = $mysqli->prepare("INSERT INTO userinfo(name, gender, age) VALUES (?, ?, ?)"))) { echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; } $stmt->bind_param("ssi", $name, $gender, $age); $stmt->execute(); $stmt->close(); // remember to $stmt->close(); //$stmt->bind_result($resultName, $resultGender, $resultAge) //Select queries return a result set if ($result = $mysqli->query("SELECT name, gender, age FROM userinfo LIMIT 10")) { printf("Select returned %d rows.\n", $result->num_rows); } /* $data = ''; $data .= '<table border="1">'; while($row = mysql_fetch_assoc($facebook)) { $data .= '<tr>'; foreach($row as $value) { $data .= '<td>$value</td>'; } $data .= '</tr>'; } $data .= '</table>'; //free result set $result->close(); }*/ } else { echo "You did not complete all of the required fields!"; } //$err = array(); //performing all validations and raising corresponding errors //if (empty($_REQUEST['name'])) $err[] = "Name field is required"; //if (empty($_REQUEST['sex'])) $err[] = "Gender field is required"; // if (empty($_REQUEST['age'])) $err[] = "Age field is required"); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 77
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 56
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 76
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 76
Branch analysis from position: 56
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 77
Branch analysis from position: 26
Branch analysis from position: 77
Branch analysis from position: 14
filename:       /in/kWZEg
function name:  (null)
number of ops:  79
compiled vars:  !0 = $server, !1 = $username, !2 = $database, !3 = $mysqli, !4 = $password, !5 = $name, !6 = $gender, !7 = $age, !8 = $stmt, !9 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'oniddb.cws.oregonstate.edu'
    5     1        ASSIGN                                                   !1, 'mcaliste-db'
    6     2        ASSIGN                                                   !2, 'mcaliste-db'
    8     3        NEW                                              $13     'mysqli'
          4        SEND_VAR_EX                                              !0
          5        SEND_VAR_EX                                              !1
          6        SEND_VAR_EX                                              !4
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !3, $13
    9    10        BOOL_NOT                                         ~16     !3
         11      > JMPNZ_EX                                         ~16     ~16, ->14
         12    >   FETCH_OBJ_R                                      ~17     !3, 'connect_errno'
         13        BOOL                                             ~16     ~17
         14    > > JMPZ                                                     ~16, ->22
   10    15    >   FETCH_OBJ_R                                      ~18     !3, 'connect_errno'
         16        CONCAT                                           ~19     'Connection+error+', ~18
         17        CONCAT                                           ~20     ~19, '+'
         18        FETCH_OBJ_R                                      ~21     !3, 'connect_error'
         19        CONCAT                                           ~22     ~20, ~21
         20        ECHO                                                     ~22
         21      > JMP                                                      ->23
   12    22    >   ECHO                                                     'Connection+successful%3Cbr%3E'
   21    23    >   ISSET_ISEMPTY_VAR                             3  ~23     '_REQUEST'
         24        BOOL_NOT                                         ~24     ~23
         25      > JMPZ                                                     ~24, ->77
   24    26    >   INIT_FCALL                                               'htmlspecialchars'
         27        FETCH_R                      global              ~25     '_REQUEST'
         28        FETCH_DIM_R                                      ~26     ~25, 'name'
         29        SEND_VAL                                                 ~26
         30        DO_ICALL                                         $27     
         31        ASSIGN                                                   !5, $27
   25    32        INIT_FCALL                                               'htmlspecialchars'
         33        FETCH_R                      global              ~29     '_REQUEST'
         34        FETCH_DIM_R                                      ~30     ~29, 'sex'
         35        SEND_VAL                                                 ~30
         36        DO_ICALL                                         $31     
         37        ASSIGN                                                   !6, $31
   26    38        INIT_FCALL                                               'htmlspecialchars'
         39        FETCH_R                      global              ~33     '_REQUEST'
         40        FETCH_DIM_R                                      ~34     ~33, 'age'
         41        SEND_VAL                                                 ~34
         42        DO_ICALL                                         $35     
         43        ASSIGN                                                   !7, $35
   31    44        INIT_METHOD_CALL                                         !3, 'prepare'
         45        SEND_VAL_EX                                              'INSERT+INTO+userinfo%28name%2C+gender%2C+age%29+VALUES+%28%3F%2C+%3F%2C+%3F%29'
         46        DO_FCALL                                      0  $37     
         47        ASSIGN                                           ~38     !8, $37
         48        BOOL_NOT                                         ~39     ~38
         49      > JMPZ                                                     ~39, ->56
   32    50    >   FETCH_OBJ_R                                      ~40     !3, 'errno'
         51        CONCAT                                           ~41     'Prepare+failed%3A+%28', ~40
         52        CONCAT                                           ~42     ~41, '%29+'
         53        FETCH_OBJ_R                                      ~43     !3, 'error'
         54        CONCAT                                           ~44     ~42, ~43
         55        ECHO                                                     ~44
   34    56    >   INIT_METHOD_CALL                                         !8, 'bind_param'
         57        SEND_VAL_EX                                              'ssi'
         58        SEND_VAR_EX                                              !5
         59        SEND_VAR_EX                                              !6
         60        SEND_VAR_EX                                              !7
         61        DO_FCALL                                      0          
   36    62        INIT_METHOD_CALL                                         !8, 'execute'
         63        DO_FCALL                                      0          
   37    64        INIT_METHOD_CALL                                         !8, 'close'
         65        DO_FCALL                                      0          
   44    66        INIT_METHOD_CALL                                         !3, 'query'
         67        SEND_VAL_EX                                              'SELECT+name%2C+gender%2C+age+FROM+userinfo+LIMIT+10'
         68        DO_FCALL                                      0  $48     
         69        ASSIGN                                           ~49     !9, $48
         70      > JMPZ                                                     ~49, ->76
   45    71    >   INIT_FCALL                                               'printf'
         72        SEND_VAL                                                 'Select+returned+%25d+rows.%0A'
         73        FETCH_OBJ_R                                      ~50     !9, 'num_rows'
         74        SEND_VAL                                                 ~50
         75        DO_ICALL                                                 
         76    > > JMP                                                      ->78
   67    77    >   ECHO                                                     'You+did+not+complete+all+of+the+required+fields%21'
   84    78    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.86 ms | 1396 KiB | 17 Q