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

End of function htmlwrapthing

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.27 ms | 1407 KiB | 16 Q