3v4l.org

run code in 500+ PHP versions simultaneously
<?php $fulltext = "-through the +use of the +tab +key"; $length = 4; function checkstring($fulltext,$length) { $words = preg_split('~\s~',$fulltext); $remains = []; foreach ($words as $word) { if (strpos($word, '-') === 0) { continue; } if (strpos($word, '+') === 0) { $word = substr($word, 1); } elseif (strlen($word) <= $length) { continue; } $remains[] = $word; } return trim(implode(' ', $remains)); } echo checkstring($fulltext, $length);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ulpZs
function name:  (null)
number of ops:  8
compiled vars:  !0 = $fulltext, !1 = $length
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '-through+the+%2Buse+of+the+%2Btab+%2Bkey'
    4     1        ASSIGN                                                       !1, 4
   29     2        INIT_FCALL                                                   'checkstring'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_FCALL                                          0  $4      
          6        ECHO                                                         $4
          7      > RETURN                                                       1

Function checkstring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 27
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 27
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 24
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/ulpZs
function name:  checkstring
number of ops:  32
compiled vars:  !0 = $fulltext, !1 = $length, !2 = $words, !3 = $remains, !4 = $word
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    8     2        INIT_FCALL                                                   'preg_split'
          3        SEND_VAL                                                     '%7E%5Cs%7E'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $5      
          6        ASSIGN                                                       !2, $5
   10     7        ASSIGN                                                       !3, <array>
   12     8      > FE_RESET_R                                           $8      !2, ->27
          9    > > FE_FETCH_R                                                   $8, !4, ->27
   14    10    >   FRAMELESS_ICALL_2                strpos              ~9      !4, '-'
         11        IS_IDENTICAL                                                 ~9, 0
         12      > JMPZ                                                         ~10, ->14
   15    13    > > JMP                                                          ->9
   18    14    >   FRAMELESS_ICALL_2                strpos              ~11     !4, '%2B'
         15        IS_IDENTICAL                                                 ~11, 0
         16      > JMPZ                                                         ~12, ->20
   19    17    >   FRAMELESS_ICALL_2                substr              ~13     !4, 1
         18        ASSIGN                                                       !4, ~13
   18    19      > JMP                                                          ->24
   21    20    >   STRLEN                                               ~15     !4
         21        IS_SMALLER_OR_EQUAL                                          ~15, !1
         22      > JMPZ                                                         ~16, ->24
   22    23    > > JMP                                                          ->9
   24    24    >   ASSIGN_DIM                                                   !3
         25        OP_DATA                                                      !4
   12    26      > JMP                                                          ->9
         27    >   FE_FREE                                                      $8
   26    28        FRAMELESS_ICALL_2                implode             ~18     '+', !3
         29        FRAMELESS_ICALL_1                trim                ~19     ~18
         30      > RETURN                                                       ~19
   27    31*     > RETURN                                                       null

End of function checkstring

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
128.4 ms | 485 KiB | 9 Q