3v4l.org

run code in 300+ PHP versions simultaneously
<?php function htmlWrapThing($str, $size){ $html = false; $i = 0; $chars = str_split($str); $return = ""; $break = false; $tag = ""; foreach($chars as $char){ if($char=="<") $html = true; if($char==">") $html = false; if($html) $t++; if($html && $char!="/" && $t > 1){ $tag .= $char; } if(!$html) $i++; $return .= $char; if($i==$size) $break = true; if($char == " " && !$html && $break){ if($oldtag != $tag){ $return .= '</'.$tag.'>'."<br><br>".'<'.$tag.'>'; $i=0; $tag = ""; }else{ $return .= '</'.$oldtag.'>'."<br><br>".'<'.$oldtag.'>'; $i=0; } $oldtag = $tag; $break = false; } } return $return; } $str = "<h1>hilo everybody how is everyone doing tonight?</h1><p>hello world how is everyone doing today</p><p>hello world how is everyone doing today</p><p>hello world how is everyone doing today</p><br><br />hello everybody how are you doing today?"; echo htmlWrapThing($str,10);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5Kii3
function name:  (null)
number of ops:  7
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   ASSIGN                                                   !0, '%3Ch1%3Ehilo+everybody+how+is+everyone+doing+tonight%3F%3C%2Fh1%3E%3Cp%3Ehello+world+how+is+everyone+doing+today%3C%2Fp%3E%3Cp%3Ehello+world+how+is+everyone+doing+today%3C%2Fp%3E%3Cp%3Ehello+world+how+is+everyone+doing+today%3C%2Fp%3E%3Cbr%3E%3Cbr+%2F%3Ehello+everybody+how+are+you+doing+today%3F'
   46     1        INIT_FCALL                                               'htmlwrapthing'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 10
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function htmlwrapthing:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 66
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 66
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 32
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
2 jumps found. (Code = 46) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
2 jumps found. (Code = 46) Position 1 = 41, Position 2 = 42
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 65
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 55
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 65
Branch analysis from position: 42
Branch analysis from position: 40
Branch analysis from position: 36
Branch analysis from position: 32
Branch analysis from position: 29
Branch analysis from position: 27
Branch analysis from position: 24
Branch analysis from position: 21
Branch analysis from position: 19
Branch analysis from position: 16
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
filename:       /in/5Kii3
function name:  htmlWrapThing
number of ops:  69
compiled vars:  !0 = $str, !1 = $size, !2 = $html, !3 = $i, !4 = $chars, !5 = $return, !6 = $break, !7 = $tag, !8 = $char, !9 = $t, !10 = $oldtag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <false>
    5     3        ASSIGN                                                   !3, 0
    6     4        INIT_FCALL                                               'str_split'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $13     
          7        ASSIGN                                                   !4, $13
    7     8        ASSIGN                                                   !5, ''
    8     9        ASSIGN                                                   !6, <false>
    9    10        ASSIGN                                                   !7, ''
   10    11      > FE_RESET_R                                       $18     !4, ->66
         12    > > FE_FETCH_R                                               $18, !8, ->66
   11    13    >   IS_EQUAL                                                 !8, '%3C'
         14      > JMPZ                                                     ~19, ->16
         15    >   ASSIGN                                                   !2, <true>
   12    16    >   IS_EQUAL                                                 !8, '%3E'
         17      > JMPZ                                                     ~21, ->19
         18    >   ASSIGN                                                   !2, <false>
   13    19    > > JMPZ                                                     !2, ->21
         20    >   PRE_INC                                                  !9
   14    21    > > JMPZ_EX                                          ~24     !2, ->24
         22    >   IS_NOT_EQUAL                                     ~25     !8, '%2F'
         23        BOOL                                             ~24     ~25
         24    > > JMPZ_EX                                          ~24     ~24, ->27
         25    >   IS_SMALLER                                       ~26     1, !9
         26        BOOL                                             ~24     ~26
         27    > > JMPZ                                                     ~24, ->29
   15    28    >   ASSIGN_OP                                     8          !7, !8
   18    29    >   BOOL_NOT                                         ~28     !2
         30      > JMPZ                                                     ~28, ->32
         31    >   PRE_INC                                                  !3
   19    32    >   ASSIGN_OP                                     8          !5, !8
   20    33        IS_EQUAL                                                 !3, !1
         34      > JMPZ                                                     ~31, ->36
         35    >   ASSIGN                                                   !6, <true>
   21    36    >   IS_EQUAL                                         ~33     !8, '+'
         37      > JMPZ_EX                                          ~33     ~33, ->40
         38    >   BOOL_NOT                                         ~34     !2
         39        BOOL                                             ~33     ~34
         40    > > JMPZ_EX                                          ~33     ~33, ->42
         41    >   BOOL                                             ~33     !6
         42    > > JMPZ                                                     ~33, ->65
   23    43    >   IS_NOT_EQUAL                                             !10, !7
         44      > JMPZ                                                     ~35, ->55
   24    45    >   CONCAT                                           ~36     '%3C%2F', !7
         46        CONCAT                                           ~37     ~36, '%3E'
         47        CONCAT                                           ~38     ~37, '%3Cbr%3E%3Cbr%3E'
         48        CONCAT                                           ~39     ~38, '%3C'
         49        CONCAT                                           ~40     ~39, !7
         50        CONCAT                                           ~41     ~40, '%3E'
         51        ASSIGN_OP                                     8          !5, ~41
   25    52        ASSIGN                                                   !3, 0
   27    53        ASSIGN                                                   !7, ''
         54      > JMP                                                      ->63
   29    55    >   CONCAT                                           ~45     '%3C%2F', !10
         56        CONCAT                                           ~46     ~45, '%3E'
         57        CONCAT                                           ~47     ~46, '%3Cbr%3E%3Cbr%3E'
         58        CONCAT                                           ~48     ~47, '%3C'
         59        CONCAT                                           ~49     ~48, !10
         60        CONCAT                                           ~50     ~49, '%3E'
         61        ASSIGN_OP                                     8          !5, ~50
   30    62        ASSIGN                                                   !3, 0
   34    63    >   ASSIGN                                                   !10, !7
   37    64        ASSIGN                                                   !6, <false>
   10    65    > > JMP                                                      ->12
         66    >   FE_FREE                                                  $18
   41    67      > RETURN                                                   !5
   42    68*     > RETURN                                                   null

End of function htmlwrapthing

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.77 ms | 1398 KiB | 16 Q