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){ $return .= '</'.$tag.'>'."<br><br>".'<'.$tag.'>'; $i=0; $break = false; } } return $return; } $str = "<p>hello world how is everyone doing today</p>"; echo htmlWrapThing($str,10);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XHNU3
function name:  (null)
number of ops:  7
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   ASSIGN                                                   !0, '%3Cp%3Ehello+world+how+is+everyone+doing+today%3C%2Fp%3E'
   33     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 = 53
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 53
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 = 52
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 52
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: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
filename:       /in/XHNU3
function name:  htmlWrapThing
number of ops:  56
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, ->53
         12    > > FE_FETCH_R                                               $17, !8, ->53
   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_NOT_EQUAL                                     ~24     !8, '%2F'
         23        BOOL                                             ~23     ~24
         24    > > JMPZ_EX                                          ~23     ~23, ->27
         25    >   IS_SMALLER                                       ~25     1, !9
         26        BOOL                                             ~23     ~25
         27    > > JMPZ                                                     ~23, ->29
   15    28    >   ASSIGN_OP                                     8          !7, !8
   18    29    >   BOOL_NOT                                         ~27     !2
         30      > JMPZ                                                     ~27, ->32
         31    >   PRE_INC                                                  !3
   19    32    >   ASSIGN_OP                                     8          !5, !8
   20    33        IS_EQUAL                                                 !3, !1
         34      > JMPZ                                                     ~30, ->36
         35    >   ASSIGN                                                   !6, <true>
   21    36    >   IS_EQUAL                                         ~32     !8, '+'
         37      > JMPZ_EX                                          ~32     ~32, ->40
         38    >   BOOL_NOT                                         ~33     !2
         39        BOOL                                             ~32     ~33
         40    > > JMPZ_EX                                          ~32     ~32, ->42
         41    >   BOOL                                             ~32     !6
         42    > > JMPZ                                                     ~32, ->52
   22    43    >   CONCAT                                           ~34     '%3C%2F', !7
         44        CONCAT                                           ~35     ~34, '%3E'
         45        CONCAT                                           ~36     ~35, '%3Cbr%3E%3Cbr%3E'
         46        CONCAT                                           ~37     ~36, '%3C'
         47        CONCAT                                           ~38     ~37, !7
         48        CONCAT                                           ~39     ~38, '%3E'
         49        ASSIGN_OP                                     8          !5, ~39
   23    50        ASSIGN                                                   !3, 0
   25    51        ASSIGN                                                   !6, <false>
   10    52    > > JMP                                                      ->12
         53    >   FE_FREE                                                  $17
   28    54      > RETURN                                                   !5
   29    55*     > RETURN                                                   null

End of function htmlwrapthing

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
203.66 ms | 1402 KiB | 16 Q