3v4l.org

run code in 300+ PHP versions simultaneously
<?php function htmlWrapThing($str, $size, $breaking){ $html = false; $i = 0; $t = 0; $tagcount = 0; $chars = str_split($str); $return = ""; $break = false; $tag = ""; $newtag=""; foreach($chars as $char){ if($char=="<"){ $tagcount++; $html = true; } if($char==">") $html = false; if(($tagcount/2)==1){ $tagcount = 0; $tag = ""; } if($html) $t++; if($html && $char!="/" && $t > 1){ $tag .= $char; $t =0; } if(!$html) $i++; $return .= $char; if($i==$size) $break = true; if($char == " " && !$html && $break){ if(!isset($tag)||$tag==""){ $return .= $breaking; }else{ $return .= '</'.$tag.'>'.$breaking.'<'.$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, "<br><br>");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DOTsO
function name:  (null)
number of ops:  8
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     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'
   63     1        INIT_FCALL                                               'htmlwrapthing'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 10
          4        SEND_VAL                                                 '%3Cbr%3E%3Cbr%3E'
          5        DO_FCALL                                      0  $2      
          6        ECHO                                                     $2
          7      > RETURN                                                   1

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

End of function htmlwrapthing

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.05 ms | 1407 KiB | 16 Q