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

End of function htmlwrapthing

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167 ms | 1403 KiB | 16 Q