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) $i++; $return .= $char; if($i==$size) $break = true; if($char == " " && !$html && $break){ $return .= '</'.$tag.'>'."<br><br>".'<'.$tag.'>'; $i=0; $break = false; } if($html) $t++; if($html && $char=="/"){ $tag = ""; }elseif($html && $char!="/" && $t > 1){ $tag .= $char; } } 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/8tH8P
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 = 21, Position 2 = 22
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
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 = 32
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 42
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 44
Branch analysis from position: 43
2 jumps found. (Code = 46) Position 1 = 45, Position 2 = 47
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 50
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 50
2 jumps found. (Code = 46) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
2 jumps found. (Code = 46) Position 1 = 54, Position 2 = 56
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 58
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 58
Branch analysis from position: 56
Branch analysis from position: 53
Branch analysis from position: 47
Branch analysis from position: 44
Branch analysis from position: 42
Branch analysis from position: 32
Branch analysis from position: 30
Branch analysis from position: 26
Branch analysis from position: 22
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/8tH8P
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>
   14    19    >   BOOL_NOT                                         ~22     !2
         20      > JMPZ                                                     ~22, ->22
         21    >   PRE_INC                                                  !3
   15    22    >   ASSIGN_OP                                     8          !5, !8
   16    23        IS_EQUAL                                                 !3, !1
         24      > JMPZ                                                     ~25, ->26
         25    >   ASSIGN                                                   !6, <true>
   17    26    >   IS_EQUAL                                         ~27     !8, '+'
         27      > JMPZ_EX                                          ~27     ~27, ->30
         28    >   BOOL_NOT                                         ~28     !2
         29        BOOL                                             ~27     ~28
         30    > > JMPZ_EX                                          ~27     ~27, ->32
         31    >   BOOL                                             ~27     !6
         32    > > JMPZ                                                     ~27, ->42
   22    33    >   CONCAT                                           ~29     '%3C%2F', !7
         34        CONCAT                                           ~30     ~29, '%3E'
         35        CONCAT                                           ~31     ~30, '%3Cbr%3E%3Cbr%3E'
         36        CONCAT                                           ~32     ~31, '%3C'
         37        CONCAT                                           ~33     ~32, !7
         38        CONCAT                                           ~34     ~33, '%3E'
         39        ASSIGN_OP                                     8          !5, ~34
   23    40        ASSIGN                                                   !3, 0
   27    41        ASSIGN                                                   !6, <false>
   30    42    > > JMPZ                                                     !2, ->44
         43    >   PRE_INC                                                  !9
   31    44    > > JMPZ_EX                                          ~39     !2, ->47
         45    >   IS_EQUAL                                         ~40     !8, '%2F'
         46        BOOL                                             ~39     ~40
         47    > > JMPZ                                                     ~39, ->50
   33    48    >   ASSIGN                                                   !7, ''
         49      > JMP                                                      ->58
   35    50    > > JMPZ_EX                                          ~42     !2, ->53
         51    >   IS_NOT_EQUAL                                     ~43     !8, '%2F'
         52        BOOL                                             ~42     ~43
         53    > > JMPZ_EX                                          ~42     ~42, ->56
         54    >   IS_SMALLER                                       ~44     1, !9
         55        BOOL                                             ~42     ~44
         56    > > JMPZ                                                     ~42, ->58
   36    57    >   ASSIGN_OP                                     8          !7, !8
   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:
149.3 ms | 1407 KiB | 16 Q