3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(isset($_POST['submit'])) { $text = htmlspecialchars($_POST['input']); $lines = explode(PHP_EOL, $text); $bullets = array(); foreach ($lines as $line) { if (strlen($line) > 0) { preg_match("/([^\s]+)\s+(\w+)/", $line,$captured); if (count($captured) > 1 ) { if (strcmp($captured[1], end($bullets))) { if (count($bullets) > 1 && !strcmp($bullets[count($bullets)-2],$captured[1])) { echo '</ul>'; array_pop($bullets); } else { echo '<ul>'; array_push($bullets, $captured[1]); } } echo "<li>$captured[2]</li>"; } } } while (count($bullets)) { echo "</ul>"; array_pop($bullets); } } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="deformat"> Formatted data <textarea rows="4" cols="50" name="input" form="deformat" placeholder="pasted formatted text here"> </textarea> Deformatted data <textarea rows="4" cols="50" name="output" form="deformat"> </textarea> <input type="submit" name="submit" value="Clean my data!"> </form>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 76
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 68
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 68
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 67
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 67
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 62
Branch analysis from position: 37
2 jumps found. (Code = 46) Position 1 = 40, Position 2 = 50
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 56
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 50
Branch analysis from position: 62
Branch analysis from position: 67
Branch analysis from position: 67
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 70
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 70
Branch analysis from position: 76
Branch analysis from position: 70
Branch analysis from position: 68
Branch analysis from position: 76
filename:       /in/L8EIR
function name:  (null)
number of ops:  82
compiled vars:  !0 = $text, !1 = $lines, !2 = $bullets, !3 = $line, !4 = $captured
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   FETCH_IS                                         ~5      '_POST'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~5, 'submit'
          2      > JMPZ                                                     ~6, ->76
    4     3    >   INIT_FCALL                                               'htmlspecialchars'
          4        FETCH_R                      global              ~7      '_POST'
          5        FETCH_DIM_R                                      ~8      ~7, 'input'
          6        SEND_VAL                                                 ~8
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !0, $9
    5     9        INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '%0A'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $11     
         13        ASSIGN                                                   !1, $11
    6    14        ASSIGN                                                   !2, <array>
    7    15      > FE_RESET_R                                       $14     !1, ->68
         16    > > FE_FETCH_R                                               $14, !3, ->68
    9    17    >   STRLEN                                           ~15     !3
         18        IS_SMALLER                                               0, ~15
         19      > JMPZ                                                     ~16, ->67
   10    20    >   INIT_FCALL                                               'preg_match'
         21        SEND_VAL                                                 '%2F%28%5B%5E%5Cs%5D%2B%29%5Cs%2B%28%5Cw%2B%29%2F'
         22        SEND_VAR                                                 !3
         23        SEND_REF                                                 !4
         24        DO_ICALL                                                 
   11    25        COUNT                                            ~18     !4
         26        IS_SMALLER                                               1, ~18
         27      > JMPZ                                                     ~19, ->67
   12    28    >   INIT_FCALL                                               'strcmp'
         29        FETCH_DIM_R                                      ~20     !4, 1
         30        SEND_VAL                                                 ~20
         31        INIT_FCALL                                               'end'
         32        SEND_REF                                                 !2
         33        DO_ICALL                                         $21     
         34        SEND_VAR                                                 $21
         35        DO_ICALL                                         $22     
         36      > JMPZ                                                     $22, ->62
   13    37    >   COUNT                                            ~23     !2
         38        IS_SMALLER                                       ~24     1, ~23
         39      > JMPZ_EX                                          ~24     ~24, ->50
         40    >   INIT_FCALL                                               'strcmp'
         41        COUNT                                            ~25     !2
         42        SUB                                              ~26     ~25, 2
         43        FETCH_DIM_R                                      ~27     !2, ~26
         44        SEND_VAL                                                 ~27
         45        FETCH_DIM_R                                      ~28     !4, 1
         46        SEND_VAL                                                 ~28
         47        DO_ICALL                                         $29     
         48        BOOL_NOT                                         ~30     $29
         49        BOOL                                             ~24     ~30
         50    > > JMPZ                                                     ~24, ->56
   14    51    >   ECHO                                                     '%3C%2Ful%3E'
   15    52        INIT_FCALL                                               'array_pop'
         53        SEND_REF                                                 !2
         54        DO_ICALL                                                 
         55      > JMP                                                      ->62
   17    56    >   ECHO                                                     '%3Cul%3E'
   18    57        INIT_FCALL                                               'array_push'
         58        SEND_REF                                                 !2
         59        FETCH_DIM_R                                      ~32     !4, 1
         60        SEND_VAL                                                 ~32
         61        DO_ICALL                                                 
   21    62    >   ROPE_INIT                                     3  ~36     '%3Cli%3E'
         63        FETCH_DIM_R                                      ~34     !4, 2
         64        ROPE_ADD                                      1  ~36     ~36, ~34
         65        ROPE_END                                      2  ~35     ~36, '%3C%2Fli%3E'
         66        ECHO                                                     ~35
    7    67    > > JMP                                                      ->16
         68    >   FE_FREE                                                  $14
   25    69      > JMP                                                      ->74
   26    70    >   ECHO                                                     '%3C%2Ful%3E'
   27    71        INIT_FCALL                                               'array_pop'
         72        SEND_REF                                                 !2
         73        DO_ICALL                                                 
   25    74    >   COUNT                                            ~39     !2
         75      > JMPNZ                                                    ~39, ->70
   34    76    >   ECHO                                                     '%3Cform+action%3D%22'
         77        FETCH_R                      global              ~40     '_SERVER'
         78        FETCH_DIM_R                                      ~41     ~40, 'PHP_SELF'
         79        ECHO                                                     ~41
         80        ECHO                                                     '%22+method%3D%22post%22+id%3D%22deformat%22%3E%0AFormatted+data+%3Ctextarea+rows%3D%224%22+cols%3D%2250%22+name%3D%22input%22+form%3D%22deformat%22+placeholder%3D%22pasted+formatted+text+here%22%3E%0A%3C%2Ftextarea%3E%0ADeformatted+data+%3Ctextarea+rows%3D%224%22+cols%3D%2250%22+name%3D%22output%22+form%3D%22deformat%22%3E%0A%3C%2Ftextarea%3E%0A%3Cinput+type%3D%22submit%22+name%3D%22submit%22+value%3D%22Clean+my+data%21%22%3E%0A%3C%2Fform%3E'
   40    81      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.69 ms | 1409 KiB | 27 Q