3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(isset($_POST['button'])) { $newDate = date("Y-m-d", strtotime($_POST['inputdate'])); $expDate = strtotime('+7 days', $newDate); $q=mysql_query("Insert into barang_masuk (`tgl`,`kode_barang`,`jumlah`) values ('".$newDate."','".$_POST['kodebarang']."','".$_POST['qty']."')") or die(mysql_error()); $q2=mysql_query("Select * from data_persediaan where kode_barang='".$_POST['kodebarang']."'"); $rc=mysql_num_rows($q2); if($rc==1) { $q3=mysql_query("Update data_persediaan SET masuk=masuk + ".$_POST['qty'].",stok_tersedia=stok_tersedia + ".$_POST['qty']." Where kode_barang='".$_POST['kodebarang']."'"); if($q3) { echo "Data sudah disimpan"; } }else{ $q4=mysql_query("Insert into data_persediaan (`kode_barang`,`stok_awal`,`masuk`,`stok_tersedia`) values ('".$_POST['kodebarang']."','".$_POST['qty']."','".$_POST['qty']."','".$_POST['qty']."')"); if($q4) { echo "Data sudah disimpan"; } } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 92
Branch analysis from position: 3
2 jumps found. (Code = 47) Position 1 = 33, Position 2 = 37
Branch analysis from position: 33
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 70
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 69
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 69
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 91, Position 2 = 92
Branch analysis from position: 91
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 92
Branch analysis from position: 92
filename:       /in/08mJ2
function name:  (null)
number of ops:  93
compiled vars:  !0 = $newDate, !1 = $expDate, !2 = $q, !3 = $q2, !4 = $rc, !5 = $q3, !6 = $q4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_IS                                         ~7      '_POST'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~7, 'button'
          2      > JMPZ                                                     ~8, ->92
    5     3    >   INIT_FCALL                                               'date'
          4        SEND_VAL                                                 'Y-m-d'
          5        INIT_FCALL                                               'strtotime'
          6        FETCH_R                      global              ~9      '_POST'
          7        FETCH_DIM_R                                      ~10     ~9, 'inputdate'
          8        SEND_VAL                                                 ~10
          9        DO_ICALL                                         $11     
         10        SEND_VAR                                                 $11
         11        DO_ICALL                                         $12     
         12        ASSIGN                                                   !0, $12
    6    13        INIT_FCALL                                               'strtotime'
         14        SEND_VAL                                                 '%2B7+days'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $14     
         17        ASSIGN                                                   !1, $14
    7    18        INIT_FCALL_BY_NAME                                       'mysql_query'
         19        CONCAT                                           ~16     'Insert+into+barang_masuk+%28%60tgl%60%2C%60kode_barang%60%2C%60jumlah%60%29+values+%28%27', !0
         20        CONCAT                                           ~17     ~16, '%27%2C%27'
         21        FETCH_R                      global              ~18     '_POST'
         22        FETCH_DIM_R                                      ~19     ~18, 'kodebarang'
         23        CONCAT                                           ~20     ~17, ~19
         24        CONCAT                                           ~21     ~20, '%27%2C%27'
         25        FETCH_R                      global              ~22     '_POST'
         26        FETCH_DIM_R                                      ~23     ~22, 'qty'
         27        CONCAT                                           ~24     ~21, ~23
         28        CONCAT                                           ~25     ~24, '%27%29'
         29        SEND_VAL_EX                                              ~25
         30        DO_FCALL                                      0  $26     
         31        ASSIGN                                           ~27     !2, $26
         32      > JMPNZ_EX                                         ~27     ~27, ->37
         33    >   INIT_FCALL_BY_NAME                                       'mysql_error'
         34        DO_FCALL                                      0  $28     
         35      > EXIT                                                     $28
         36*       BOOL                                             ~27     <true>
    8    37    >   INIT_FCALL_BY_NAME                                       'mysql_query'
         38        FETCH_R                      global              ~29     '_POST'
         39        FETCH_DIM_R                                      ~30     ~29, 'kodebarang'
         40        CONCAT                                           ~31     'Select+%2A+from+data_persediaan+where+kode_barang%3D%27', ~30
         41        CONCAT                                           ~32     ~31, '%27'
         42        SEND_VAL_EX                                              ~32
         43        DO_FCALL                                      0  $33     
         44        ASSIGN                                                   !3, $33
    9    45        INIT_FCALL_BY_NAME                                       'mysql_num_rows'
         46        SEND_VAR_EX                                              !3
         47        DO_FCALL                                      0  $35     
         48        ASSIGN                                                   !4, $35
   10    49        IS_EQUAL                                                 !4, 1
         50      > JMPZ                                                     ~37, ->70
   12    51    >   INIT_FCALL_BY_NAME                                       'mysql_query'
         52        FETCH_R                      global              ~38     '_POST'
         53        FETCH_DIM_R                                      ~39     ~38, 'qty'
         54        CONCAT                                           ~40     'Update+data_persediaan+SET+masuk%3Dmasuk+%2B+', ~39
         55        CONCAT                                           ~41     ~40, '%2Cstok_tersedia%3Dstok_tersedia+%2B+'
         56        FETCH_R                      global              ~42     '_POST'
         57        FETCH_DIM_R                                      ~43     ~42, 'qty'
         58        CONCAT                                           ~44     ~41, ~43
         59        CONCAT                                           ~45     ~44, '+Where+kode_barang%3D%27'
         60        FETCH_R                      global              ~46     '_POST'
         61        FETCH_DIM_R                                      ~47     ~46, 'kodebarang'
         62        CONCAT                                           ~48     ~45, ~47
         63        CONCAT                                           ~49     ~48, '%27'
         64        SEND_VAL_EX                                              ~49
         65        DO_FCALL                                      0  $50     
         66        ASSIGN                                                   !5, $50
   13    67      > JMPZ                                                     !5, ->69
   15    68    >   ECHO                                                     'Data+sudah+disimpan'
         69    > > JMP                                                      ->92
   18    70    >   INIT_FCALL_BY_NAME                                       'mysql_query'
         71        FETCH_R                      global              ~52     '_POST'
         72        FETCH_DIM_R                                      ~53     ~52, 'kodebarang'
         73        CONCAT                                           ~54     'Insert+into+data_persediaan+%28%60kode_barang%60%2C%60stok_awal%60%2C%60masuk%60%2C%60stok_tersedia%60%29+values+%28%27', ~53
         74        CONCAT                                           ~55     ~54, '%27%2C%27'
         75        FETCH_R                      global              ~56     '_POST'
         76        FETCH_DIM_R                                      ~57     ~56, 'qty'
         77        CONCAT                                           ~58     ~55, ~57
         78        CONCAT                                           ~59     ~58, '%27%2C%27'
         79        FETCH_R                      global              ~60     '_POST'
         80        FETCH_DIM_R                                      ~61     ~60, 'qty'
         81        CONCAT                                           ~62     ~59, ~61
         82        CONCAT                                           ~63     ~62, '%27%2C%27'
         83        FETCH_R                      global              ~64     '_POST'
         84        FETCH_DIM_R                                      ~65     ~64, 'qty'
         85        CONCAT                                           ~66     ~63, ~65
         86        CONCAT                                           ~67     ~66, '%27%29'
         87        SEND_VAL_EX                                              ~67
         88        DO_FCALL                                      0  $68     
         89        ASSIGN                                                   !6, $68
   19    90      > JMPZ                                                     !6, ->92
   21    91    >   ECHO                                                     'Data+sudah+disimpan'
   25    92    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.51 ms | 1404 KiB | 17 Q