3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '我上的发顺丰testse'; function StringToArray($str) { $result = array(); $len = strlen($str); $i = 0; while($i < $len){ $chr = ord($str[$i]); if($chr == 9 || $chr == 10 || (32 <= $chr && $chr <= 126)) { $result[] = substr($str,$i,1); $i +=1; }elseif(192 <= $chr && $chr <= 223){ $result[] = substr($str,$i,2); $i +=2; }elseif(224 <= $chr && $chr <= 239){ $result[] = substr($str,$i,3); $i +=3; }elseif(240 <= $chr && $chr <= 247){ $result[] = substr($str,$i,4); $i +=4; }elseif(248 <= $chr && $chr <= 251){ $result[] = substr($str,$i,5); $i +=5; }elseif(252 <= $chr && $chr <= 253){ $result[] = substr($str,$i,6); $i +=6; } } return $result; } var_dump(StringToArray($str)); var_dump(mb_strlen('test','utf-8')); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vHLs2
function name:  (null)
number of ops:  15
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%E6%88%91%E4%B8%8A%E7%9A%84%E5%8F%91%E9%A1%BA%E4%B8%B0testse'
   33     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'stringtoarray'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
   34     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'mb_strlen'
          9        SEND_VAL                                                 'test'
         10        SEND_VAL                                                 'utf-8'
         11        DO_ICALL                                         $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                                 
   36    14      > RETURN                                                   1

Function stringtoarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 100
Branch analysis from position: 100
2 jumps found. (Code = 44) Position 1 = 102, Position 2 = 6
Branch analysis from position: 102
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 47) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 47) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 31
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 100
Branch analysis from position: 100
Branch analysis from position: 31
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 45
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 100
Branch analysis from position: 100
Branch analysis from position: 45
2 jumps found. (Code = 46) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 59
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 100
Branch analysis from position: 100
Branch analysis from position: 59
2 jumps found. (Code = 46) Position 1 = 61, Position 2 = 63
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 73
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 100
Branch analysis from position: 100
Branch analysis from position: 73
2 jumps found. (Code = 46) Position 1 = 75, Position 2 = 77
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 87
Branch analysis from position: 78
1 jumps found. (Code = 42) Position 1 = 100
Branch analysis from position: 100
Branch analysis from position: 87
2 jumps found. (Code = 46) Position 1 = 89, Position 2 = 91
Branch analysis from position: 89
2 jumps found. (Code = 43) Position 1 = 92, Position 2 = 100
Branch analysis from position: 92
2 jumps found. (Code = 44) Position 1 = 102, Position 2 = 6
Branch analysis from position: 102
Branch analysis from position: 6
Branch analysis from position: 100
Branch analysis from position: 91
Branch analysis from position: 77
Branch analysis from position: 63
Branch analysis from position: 49
Branch analysis from position: 35
Branch analysis from position: 20
Branch analysis from position: 21
Branch analysis from position: 15
filename:       /in/vHLs2
function name:  StringToArray
number of ops:  104
compiled vars:  !0 = $str, !1 = $result, !2 = $len, !3 = $i, !4 = $chr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, <array>
    7     2        STRLEN                                           ~6      !0
          3        ASSIGN                                                   !2, ~6
    8     4        ASSIGN                                                   !3, 0
    9     5      > JMP                                                      ->100
   10     6    >   INIT_FCALL                                               'ord'
          7        FETCH_DIM_R                                      ~9      !0, !3
          8        SEND_VAL                                                 ~9
          9        DO_ICALL                                         $10     
         10        ASSIGN                                                   !4, $10
   11    11        IS_EQUAL                                         ~12     !4, 9
         12      > JMPNZ_EX                                         ~12     ~12, ->15
         13    >   IS_EQUAL                                         ~13     !4, 10
         14        BOOL                                             ~12     ~13
         15    > > JMPNZ_EX                                         ~12     ~12, ->21
         16    >   IS_SMALLER_OR_EQUAL                              ~14     32, !4
         17      > JMPZ_EX                                          ~14     ~14, ->20
         18    >   IS_SMALLER_OR_EQUAL                              ~15     !4, 126
         19        BOOL                                             ~14     ~15
         20    >   BOOL                                             ~12     ~14
         21    > > JMPZ                                                     ~12, ->31
   12    22    >   INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !0
         24        SEND_VAR                                                 !3
         25        SEND_VAL                                                 1
         26        DO_ICALL                                         $17     
         27        ASSIGN_DIM                                               !1
         28        OP_DATA                                                  $17
   13    29        ASSIGN_OP                                     1          !3, 1
         30      > JMP                                                      ->100
   14    31    >   IS_SMALLER_OR_EQUAL                              ~19     192, !4
         32      > JMPZ_EX                                          ~19     ~19, ->35
         33    >   IS_SMALLER_OR_EQUAL                              ~20     !4, 223
         34        BOOL                                             ~19     ~20
         35    > > JMPZ                                                     ~19, ->45
   15    36    >   INIT_FCALL                                               'substr'
         37        SEND_VAR                                                 !0
         38        SEND_VAR                                                 !3
         39        SEND_VAL                                                 2
         40        DO_ICALL                                         $22     
         41        ASSIGN_DIM                                               !1
         42        OP_DATA                                                  $22
   16    43        ASSIGN_OP                                     1          !3, 2
         44      > JMP                                                      ->100
   17    45    >   IS_SMALLER_OR_EQUAL                              ~24     224, !4
         46      > JMPZ_EX                                          ~24     ~24, ->49
         47    >   IS_SMALLER_OR_EQUAL                              ~25     !4, 239
         48        BOOL                                             ~24     ~25
         49    > > JMPZ                                                     ~24, ->59
   18    50    >   INIT_FCALL                                               'substr'
         51        SEND_VAR                                                 !0
         52        SEND_VAR                                                 !3
         53        SEND_VAL                                                 3
         54        DO_ICALL                                         $27     
         55        ASSIGN_DIM                                               !1
         56        OP_DATA                                                  $27
   19    57        ASSIGN_OP                                     1          !3, 3
         58      > JMP                                                      ->100
   20    59    >   IS_SMALLER_OR_EQUAL                              ~29     240, !4
         60      > JMPZ_EX                                          ~29     ~29, ->63
         61    >   IS_SMALLER_OR_EQUAL                              ~30     !4, 247
         62        BOOL                                             ~29     ~30
         63    > > JMPZ                                                     ~29, ->73
   21    64    >   INIT_FCALL                                               'substr'
         65        SEND_VAR                                                 !0
         66        SEND_VAR                                                 !3
         67        SEND_VAL                                                 4
         68        DO_ICALL                                         $32     
         69        ASSIGN_DIM                                               !1
         70        OP_DATA                                                  $32
   22    71        ASSIGN_OP                                     1          !3, 4
         72      > JMP                                                      ->100
   23    73    >   IS_SMALLER_OR_EQUAL                              ~34     248, !4
         74      > JMPZ_EX                                          ~34     ~34, ->77
         75    >   IS_SMALLER_OR_EQUAL                              ~35     !4, 251
         76        BOOL                                             ~34     ~35
         77    > > JMPZ                                                     ~34, ->87
   24    78    >   INIT_FCALL                                               'substr'
         79        SEND_VAR                                                 !0
         80        SEND_VAR                                                 !3
         81        SEND_VAL                                                 5
         82        DO_ICALL                                         $37     
         83        ASSIGN_DIM                                               !1
         84        OP_DATA                                                  $37
   25    85        ASSIGN_OP                                     1          !3, 5
         86      > JMP                                                      ->100
   26    87    >   IS_SMALLER_OR_EQUAL                              ~39     252, !4
         88      > JMPZ_EX                                          ~39     ~39, ->91
         89    >   IS_SMALLER_OR_EQUAL                              ~40     !4, 253
         90        BOOL                                             ~39     ~40
         91    > > JMPZ                                                     ~39, ->100
   27    92    >   INIT_FCALL                                               'substr'
         93        SEND_VAR                                                 !0
         94        SEND_VAR                                                 !3
         95        SEND_VAL                                                 6
         96        DO_ICALL                                         $42     
         97        ASSIGN_DIM                                               !1
         98        OP_DATA                                                  $42
   28    99        ASSIGN_OP                                     1          !3, 6
    9   100    >   IS_SMALLER                                               !3, !2
        101      > JMPNZ                                                    ~44, ->6
   31   102    > > RETURN                                                   !1
   32   103*     > RETURN                                                   null

End of function stringtoarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.07 ms | 1411 KiB | 22 Q