3v4l.org

run code in 300+ PHP versions simultaneously
<?php function showOrders($con) { if (!con) { echo "No Connection"; // mysqli_connect_error() <-- use this to debug, but don't show this live } elseif (!$pending_orders = mysqli_query($con, "SELECT OrderNum, product_id, product_color, product_size, product_quality, date, status FROM `Purchase_Order` WHERE status = 'pending' ORDER BY date ASC")) { echo "Pending Orders Query Syntax Error"; // mysqli_error($con) <-- use this to debug, but don't show this live } elseif (!mysqli_num_rows($pending_orders)) { echo "No Pending Orders In Database"; } else { echo '<form action ="PurchaseOrders.php"><table style="border: 1px solid black; border-collapse: collapse; width: 1300px; margin-bottom: 50px; margin-top: 5px; font-size:20px;"> <tr style="border :1px solid black; background-color: black; color: whitesmoke"> <th>ORDER #</th> <th>PRODUCT ID</th> <th>COLOR</th> <th>SIZE</th> <th>QTY</th> <th>DATE ORDERED</th> <th>STATUS</th> </tr>'; while($row = mysqli_fetch_array($pending_orders)) { /* use css to alternate background color if($counter% 2 == 0) { $bg = 'rgba(50,205,50, 0.2);'; } else { $bg = ''; } */ // if ($status === "shipped") { $newstat = "pending"; } else { $newstat = "shipped"; } // omit, this is impossible echo '<tr>'; // use css styling to alternate background color echo "<td>{$row['OrderNum']}</td>"; echo "<td>{$row['product_id']}</td>"; echo "<td>{$row['product_size']}</td>"; echo "<td>{$row['product_color']}</td>"; echo "<td>{$row['product_quantity']}</td>"; echo "<td>{$row['date']}</td>"; echo "<td><select name=\"status\" onchange=\"ship('{$row['OrderNum']}','{$row['product_id']}')\"><option>pending</option><option>shipped</option</td>"; echo '</tr>'; } echo "</form>"; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D7TY9
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E > > RETURN                                                   1

Function showorders:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 24
Branch analysis from position: 69
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 24
Branch analysis from position: 69
Branch analysis from position: 24
filename:       /in/D7TY9
function name:  showOrders
number of ops:  71
compiled vars:  !0 = $con, !1 = $pending_orders, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        FETCH_CONSTANT                                   ~3      'con'
          2        BOOL_NOT                                         ~4      ~3
          3      > JMPZ                                                     ~4, ->6
    4     4    >   ECHO                                                     'No+Connection'
    3     5      > JMP                                                      ->70
    5     6    >   INIT_FCALL_BY_NAME                                       'mysqli_query'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAL_EX                                              'SELECT+OrderNum%2C+product_id%2C+product_color%2C+product_size%2C+product_quality%2C+date%2C+status+FROM+%60Purchase_Order%60+WHERE+status+%3D+%27pending%27+ORDER+BY+date+ASC'
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                           ~6      !1, $5
         11        BOOL_NOT                                         ~7      ~6
         12      > JMPZ                                                     ~7, ->15
    6    13    >   ECHO                                                     'Pending+Orders+Query+Syntax+Error'
    5    14      > JMP                                                      ->70
    7    15    >   INIT_FCALL_BY_NAME                                       'mysqli_num_rows'
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0  $8      
         18        BOOL_NOT                                         ~9      $8
         19      > JMPZ                                                     ~9, ->22
    8    20    >   ECHO                                                     'No+Pending+Orders+In+Database'
    7    21      > JMP                                                      ->70
   10    22    >   ECHO                                                     '%3Cform+action+%3D%22PurchaseOrders.php%22%3E%3Ctable+style%3D%22border%3A+1px+solid+black%3B+border-collapse%3A+collapse%3B+width%3A+1300px%3B+margin-bottom%3A+50px%3B+margin-top%3A+5px%3B+font-size%3A20px%3B%22%3E+%0A++++++++++++%3Ctr+style%3D%22border+%3A1px+solid+black%3B+background-color%3A+black%3B+color%3A+whitesmoke%22%3E%0A+++++++++++++++++%3Cth%3EORDER+%23%3C%2Fth%3E%0A+++++++++++++++++%3Cth%3EPRODUCT+ID%3C%2Fth%3E%0A+++++++++++++++++%3Cth%3ECOLOR%3C%2Fth%3E%0A+++++++++++++++++%3Cth%3ESIZE%3C%2Fth%3E%0A+++++++++++++++++%3Cth%3EQTY%3C%2Fth%3E%0A+++++++++++++++++%3Cth%3EDATE+ORDERED%3C%2Fth%3E%0A+++++++++++++++++%3Cth%3ESTATUS%3C%2Fth%3E%0A+++++++++++++%3C%2Ftr%3E'
   20    23      > JMP                                                      ->64
   31    24    >   ECHO                                                     '%3Ctr%3E'
   32    25        ROPE_INIT                                     3  ~12     '%3Ctd%3E'
         26        FETCH_DIM_R                                      ~10     !2, 'OrderNum'
         27        ROPE_ADD                                      1  ~12     ~12, ~10
         28        ROPE_END                                      2  ~11     ~12, '%3C%2Ftd%3E'
         29        ECHO                                                     ~11
   33    30        ROPE_INIT                                     3  ~16     '%3Ctd%3E'
         31        FETCH_DIM_R                                      ~14     !2, 'product_id'
         32        ROPE_ADD                                      1  ~16     ~16, ~14
         33        ROPE_END                                      2  ~15     ~16, '%3C%2Ftd%3E'
         34        ECHO                                                     ~15
   34    35        ROPE_INIT                                     3  ~20     '%3Ctd%3E'
         36        FETCH_DIM_R                                      ~18     !2, 'product_size'
         37        ROPE_ADD                                      1  ~20     ~20, ~18
         38        ROPE_END                                      2  ~19     ~20, '%3C%2Ftd%3E'
         39        ECHO                                                     ~19
   35    40        ROPE_INIT                                     3  ~24     '%3Ctd%3E'
         41        FETCH_DIM_R                                      ~22     !2, 'product_color'
         42        ROPE_ADD                                      1  ~24     ~24, ~22
         43        ROPE_END                                      2  ~23     ~24, '%3C%2Ftd%3E'
         44        ECHO                                                     ~23
   36    45        ROPE_INIT                                     3  ~28     '%3Ctd%3E'
         46        FETCH_DIM_R                                      ~26     !2, 'product_quantity'
         47        ROPE_ADD                                      1  ~28     ~28, ~26
         48        ROPE_END                                      2  ~27     ~28, '%3C%2Ftd%3E'
         49        ECHO                                                     ~27
   37    50        ROPE_INIT                                     3  ~32     '%3Ctd%3E'
         51        FETCH_DIM_R                                      ~30     !2, 'date'
         52        ROPE_ADD                                      1  ~32     ~32, ~30
         53        ROPE_END                                      2  ~31     ~32, '%3C%2Ftd%3E'
         54        ECHO                                                     ~31
   38    55        ROPE_INIT                                     5  ~37     '%3Ctd%3E%3Cselect+name%3D%22status%22+onchange%3D%22ship%28%27'
         56        FETCH_DIM_R                                      ~34     !2, 'OrderNum'
         57        ROPE_ADD                                      1  ~37     ~37, ~34
         58        ROPE_ADD                                      2  ~37     ~37, '%27%2C%27'
         59        FETCH_DIM_R                                      ~35     !2, 'product_id'
         60        ROPE_ADD                                      3  ~37     ~37, ~35
         61        ROPE_END                                      4  ~36     ~37, '%27%29%22%3E%3Coption%3Epending%3C%2Foption%3E%3Coption%3Eshipped%3C%2Foption%3C%2Ftd%3E'
         62        ECHO                                                     ~36
   39    63        ECHO                                                     '%3C%2Ftr%3E'
   20    64    >   INIT_FCALL_BY_NAME                                       'mysqli_fetch_array'
         65        SEND_VAR_EX                                              !1
         66        DO_FCALL                                      0  $40     
         67        ASSIGN                                           ~41     !2, $40
         68      > JMPNZ                                                    ~41, ->24
   41    69    >   ECHO                                                     '%3C%2Fform%3E'
   43    70    > > RETURN                                                   null

End of function showorders

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.13 ms | 1008 KiB | 13 Q