3v4l.org

run code in 300+ PHP versions simultaneously
<?php $certidoes = array( array( 'id_certidao' => 1, 'checked' => 1 ), array( 'id_certidao' => 2, 'checked' => 0 ), array( 'id_certidao' => 3, 'checked' => 1 ) ); foreach ($certidoes as $certidao) { $checked = ""; if ($certidao['checked']) { $checked = "checked"; } echo '<input type="checkbox" id="check_'.$certidao['id_certidao'].'" name="check['.$certidao['id_certidao'].']" ' . $checked . ' value="1" />' . PHP_EOL; } //Dados para teste $_POST['check'] = array( 0 => 1, 1 => 3 ); $_POST['emissao'] = array( 1 => '10/10/2013', 2 => '11/10/2013', 3 => '12/10/2013' ); $_POST['validade'] = array( 1 => '10/10/2013', 2 => '10/11/2013', 3 => '10/12/2013' ); if (isset($_POST['check'])) { foreach ($_POST['check'] as $id) { $id_certidao = filter_var($id, FILTER_SANITIZE_NUMBER_INT); $emissao = filter_var($_POST['emissao'][$id_certidao], FILTER_SANITIZE_STRING); $validade = filter_var($_POST['validade'][$id_certidao], FILTER_SANITIZE_STRING); $insert = "INSERT INTO tb_certidao VALUES ( '$id_certidao', '$emissao', '$validade' )"; echo $insert.PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 18
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 68
Branch analysis from position: 31
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 67
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 67
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 67
Branch analysis from position: 68
Branch analysis from position: 18
filename:       /in/Wps4A
function name:  (null)
number of ops:  69
compiled vars:  !0 = $certidoes, !1 = $certidao, !2 = $checked, !3 = $id, !4 = $id_certidao, !5 = $emissao, !6 = $validade, !7 = $insert
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   17     1      > FE_RESET_R                                       $9      !0, ->18
          2    > > FE_FETCH_R                                               $9, !1, ->18
   18     3    >   ASSIGN                                                   !2, ''
   19     4        FETCH_DIM_R                                      ~11     !1, 'checked'
          5      > JMPZ                                                     ~11, ->7
   20     6    >   ASSIGN                                                   !2, 'checked'
   23     7    >   FETCH_DIM_R                                      ~13     !1, 'id_certidao'
          8        CONCAT                                           ~14     '%3Cinput+type%3D%22checkbox%22+id%3D%22check_', ~13
          9        CONCAT                                           ~15     ~14, '%22+name%3D%22check%5B'
         10        FETCH_DIM_R                                      ~16     !1, 'id_certidao'
         11        CONCAT                                           ~17     ~15, ~16
         12        CONCAT                                           ~18     ~17, '%5D%22+'
         13        CONCAT                                           ~19     ~18, !2
         14        CONCAT                                           ~20     ~19, '+value%3D%221%22+%2F%3E'
         15        CONCAT                                           ~21     ~20, '%0A'
         16        ECHO                                                     ~21
   17    17      > JMP                                                      ->2
         18    >   FE_FREE                                                  $9
   27    19        FETCH_W                      global              $22     '_POST'
         20        ASSIGN_DIM                                               $22, 'check'
   28    21        OP_DATA                                                  <array>
   32    22        FETCH_W                      global              $24     '_POST'
         23        ASSIGN_DIM                                               $24, 'emissao'
   33    24        OP_DATA                                                  <array>
   38    25        FETCH_W                      global              $26     '_POST'
         26        ASSIGN_DIM                                               $26, 'validade'
   39    27        OP_DATA                                                  <array>
   44    28        FETCH_IS                                         ~28     '_POST'
         29        ISSET_ISEMPTY_DIM_OBJ                         0          ~28, 'check'
         30      > JMPZ                                                     ~29, ->68
   45    31    >   FETCH_R                      global              ~30     '_POST'
         32        FETCH_DIM_R                                      ~31     ~30, 'check'
         33      > FE_RESET_R                                       $32     ~31, ->67
         34    > > FE_FETCH_R                                               $32, !3, ->67
   46    35    >   INIT_FCALL                                               'filter_var'
         36        SEND_VAR                                                 !3
         37        SEND_VAL                                                 519
         38        DO_ICALL                                         $33     
         39        ASSIGN                                                   !4, $33
   47    40        INIT_FCALL                                               'filter_var'
         41        FETCH_R                      global              ~35     '_POST'
         42        FETCH_DIM_R                                      ~36     ~35, 'emissao'
         43        FETCH_DIM_R                                      ~37     ~36, !4
         44        SEND_VAL                                                 ~37
         45        SEND_VAL                                                 513
         46        DO_ICALL                                         $38     
         47        ASSIGN                                                   !5, $38
   48    48        INIT_FCALL                                               'filter_var'
         49        FETCH_R                      global              ~40     '_POST'
         50        FETCH_DIM_R                                      ~41     ~40, 'validade'
         51        FETCH_DIM_R                                      ~42     ~41, !4
         52        SEND_VAL                                                 ~42
         53        SEND_VAL                                                 513
         54        DO_ICALL                                         $43     
         55        ASSIGN                                                   !6, $43
   50    56        ROPE_INIT                                     7  ~46     'INSERT+INTO+tb_certidao%0A+++++++++++++++++++VALUES+%28%0A++++++++++++++++++++++%27'
   52    57        ROPE_ADD                                      1  ~46     ~46, !4
         58        ROPE_ADD                                      2  ~46     ~46, '%27%2C%0A++++++++++++++++++++++%27'
   53    59        ROPE_ADD                                      3  ~46     ~46, !5
         60        ROPE_ADD                                      4  ~46     ~46, '%27%2C%0A++++++++++++++++++++++%27'
   54    61        ROPE_ADD                                      5  ~46     ~46, !6
         62        ROPE_END                                      6  ~45     ~46, '%27%0A+++++++++++++++++++%29'
   50    63        ASSIGN                                                   !7, ~45
   57    64        CONCAT                                           ~51     !7, '%0A'
         65        ECHO                                                     ~51
   45    66      > JMP                                                      ->34
         67    >   FE_FREE                                                  $32
   59    68    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.46 ms | 1400 KiB | 15 Q