3v4l.org

run code in 300+ PHP versions simultaneously
<html> <head> <script> function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","q"); xmlhttp.send(); } </script> </head> <body> <form> <select name="users" onchange="showUser(this.value)"> <option value="">Select a person:</option> <option value="1">Peter Griffin</option> <option value="2">Lois Griffin</option> <option value="3">Joseph Swanson</option> <option value="4">Glenn Quagmire</option> </select> </form> <br> <div id="txtHint"><b>Person info will be listed here.</b></div> </body> </html> <?php $q = intval($_GET['q']); $con = mysqli_connect('localhost','peter','abc123','my_db'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"ajax_demo"); $sql="SELECT * FROM user WHERE id = '".$q."'"; $result = mysqli_query($con,$sql); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> <th>Hometown</th> <th>Job</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "<td>" . $row['Age'] . "</td>"; echo "<td>" . $row['Hometown'] . "</td>"; echo "<td>" . $row['Job'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 33
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 33
Branch analysis from position: 60
Branch analysis from position: 33
filename:       /in/tLiX1
function name:  (null)
number of ops:  65
compiled vars:  !0 = $q, !1 = $con, !2 = $sql, !3 = $result, !4 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3Chtml%3E%0A%3Chead%3E%0A%3Cscript%3E%0Afunction+showUser%28str%29+%7B%0A++if+%28str%3D%3D%22%22%29+%7B%0A++++document.getElementById%28%22txtHint%22%29.innerHTML%3D%22%22%3B%0A++++return%3B%0A++%7D+%0A++if+%28window.XMLHttpRequest%29+%7B%0A++++%2F%2F+code+for+IE7%2B%2C+Firefox%2C+Chrome%2C+Opera%2C+Safari%0A++++xmlhttp%3Dnew+XMLHttpRequest%28%29%3B%0A++%7D+else+%7B+%2F%2F+code+for+IE6%2C+IE5%0A++++xmlhttp%3Dnew+ActiveXObject%28%22Microsoft.XMLHTTP%22%29%3B%0A++%7D%0A++xmlhttp.onreadystatechange%3Dfunction%28%29+%7B%0A++++if+%28xmlhttp.readyState%3D%3D4+%26%26+xmlhttp.status%3D%3D200%29+%7B%0A++++++document.getElementById%28%22txtHint%22%29.innerHTML%3Dxmlhttp.responseText%3B%0A++++%7D%0A++%7D%0A++xmlhttp.open%28%22GET%22%2C%22q%22%29%3B%0A++xmlhttp.send%28%29%3B%0A%7D%0A%3C%2Fscript%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%0A%3Cform%3E%0A%3Cselect+name%3D%22users%22+onchange%3D%22showUser%28this.value%29%22%3E%0A%3Coption+value%3D%22%22%3ESelect+a+person%3A%3C%2Foption%3E%0A%3Coption+value%3D%221%22%3EPeter+Griffin%3C%2Foption%3E%0A%3Coption+value%3D%222%22%3ELois+Griffin%3C%2Foption%3E%0A%3Coption+value%3D%223%22%3EJoseph+Swanson%3C%2Foption%3E%0A%3Coption+value%3D%224%22%3EGlenn+Quagmire%3C%2Foption%3E%0A%3C%2Fselect%3E%0A%3C%2Fform%3E%0A%3Cbr%3E%0A%3Cdiv+id%3D%22txtHint%22%3E%3Cb%3EPerson+info+will+be+listed+here.%3C%2Fb%3E%3C%2Fdiv%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A%0A%0A%0A'
   45     1        FETCH_R                      global              ~5      '_GET'
          2        FETCH_DIM_R                                      ~6      ~5, 'q'
          3        CAST                                          4  ~7      ~6
          4        ASSIGN                                                   !0, ~7
   47     5        INIT_FCALL_BY_NAME                                       'mysqli_connect'
          6        SEND_VAL_EX                                              'localhost'
          7        SEND_VAL_EX                                              'peter'
          8        SEND_VAL_EX                                              'abc123'
          9        SEND_VAL_EX                                              'my_db'
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !1, $9
   48    12        BOOL_NOT                                         ~11     !1
         13      > JMPZ                                                     ~11, ->19
   49    14    >   INIT_FCALL_BY_NAME                                       'mysqli_error'
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0  $12     
         17        CONCAT                                           ~13     'Could+not+connect%3A+', $12
         18      > EXIT                                                     ~13
   52    19    >   INIT_FCALL_BY_NAME                                       'mysqli_select_db'
         20        SEND_VAR_EX                                              !1
         21        SEND_VAL_EX                                              'ajax_demo'
         22        DO_FCALL                                      0          
   53    23        CONCAT                                           ~15     'SELECT+%2A+FROM+user+WHERE+id+%3D+%27', !0
         24        CONCAT                                           ~16     ~15, '%27'
         25        ASSIGN                                                   !2, ~16
   54    26        INIT_FCALL_BY_NAME                                       'mysqli_query'
         27        SEND_VAR_EX                                              !1
         28        SEND_VAR_EX                                              !2
         29        DO_FCALL                                      0  $18     
         30        ASSIGN                                                   !3, $18
   56    31        ECHO                                                     '%3Ctable+border%3D%271%27%3E%0A%3Ctr%3E%0A%3Cth%3EFirstname%3C%2Fth%3E%0A%3Cth%3ELastname%3C%2Fth%3E%0A%3Cth%3EAge%3C%2Fth%3E%0A%3Cth%3EHometown%3C%2Fth%3E%0A%3Cth%3EJob%3C%2Fth%3E%0A%3C%2Ftr%3E'
   65    32      > JMP                                                      ->55
   66    33    >   ECHO                                                     '%3Ctr%3E'
   67    34        FETCH_DIM_R                                      ~20     !4, 'FirstName'
         35        CONCAT                                           ~21     '%3Ctd%3E', ~20
         36        CONCAT                                           ~22     ~21, '%3C%2Ftd%3E'
         37        ECHO                                                     ~22
   68    38        FETCH_DIM_R                                      ~23     !4, 'LastName'
         39        CONCAT                                           ~24     '%3Ctd%3E', ~23
         40        CONCAT                                           ~25     ~24, '%3C%2Ftd%3E'
         41        ECHO                                                     ~25
   69    42        FETCH_DIM_R                                      ~26     !4, 'Age'
         43        CONCAT                                           ~27     '%3Ctd%3E', ~26
         44        CONCAT                                           ~28     ~27, '%3C%2Ftd%3E'
         45        ECHO                                                     ~28
   70    46        FETCH_DIM_R                                      ~29     !4, 'Hometown'
         47        CONCAT                                           ~30     '%3Ctd%3E', ~29
         48        CONCAT                                           ~31     ~30, '%3C%2Ftd%3E'
         49        ECHO                                                     ~31
   71    50        FETCH_DIM_R                                      ~32     !4, 'Job'
         51        CONCAT                                           ~33     '%3Ctd%3E', ~32
         52        CONCAT                                           ~34     ~33, '%3C%2Ftd%3E'
         53        ECHO                                                     ~34
   72    54        ECHO                                                     '%3C%2Ftr%3E'
   65    55    >   INIT_FCALL_BY_NAME                                       'mysqli_fetch_array'
         56        SEND_VAR_EX                                              !3
         57        DO_FCALL                                      0  $35     
         58        ASSIGN                                           ~36     !4, $35
         59      > JMPNZ                                                    ~36, ->33
   74    60    >   ECHO                                                     '%3C%2Ftable%3E'
   76    61        INIT_FCALL_BY_NAME                                       'mysqli_close'
         62        SEND_VAR_EX                                              !1
         63        DO_FCALL                                      0          
   77    64      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.91 ms | 1399 KiB | 13 Q