3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Hello Friend统计" ; print_r(explode(' ',$str)); $arr1 = str_split ( $str ); $arr2 = str_split ( $str , 3 );//按3个字节分割 print_r($arr1); print_r($arr2); function str_split_unicode($str, $l = 0) { if ($l > 0) { $ret = array(); $len = mb_strlen($str, "UTF-8"); for ($i = 0; $i < $len; $i += $l) { $ret[] = mb_substr($str, $i, $l, "UTF-8"); } return $ret; } return preg_split("//u", $str, -1, PREG_SPLIT_NO_EMPTY); } $s = '无符号整数'; // Open Source! print_r(str_split_unicode($s)); print_r(str_split_unicode($s, 3));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uRnT3
function name:  (null)
number of ops:  38
compiled vars:  !0 = $str, !1 = $arr1, !2 = $arr2, !3 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Hello+Friend%E7%BB%9F%E8%AE%A1'
    3     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        DO_ICALL                                                 
    4     8        INIT_FCALL                                               'str_split'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !1, $7
    5    12        INIT_FCALL                                               'str_split'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 3
         15        DO_ICALL                                         $9      
         16        ASSIGN                                                   !2, $9
    6    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
    7    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
   19    23        ASSIGN                                                   !3, '%E6%97%A0%E7%AC%A6%E5%8F%B7%E6%95%B4%E6%95%B0'
   21    24        INIT_FCALL                                               'print_r'
         25        INIT_FCALL                                               'str_split_unicode'
         26        SEND_VAR                                                 !3
         27        DO_FCALL                                      0  $14     
         28        SEND_VAR                                                 $14
         29        DO_ICALL                                                 
   22    30        INIT_FCALL                                               'print_r'
         31        INIT_FCALL                                               'str_split_unicode'
         32        SEND_VAR                                                 !3
         33        SEND_VAL                                                 3
         34        DO_FCALL                                      0  $16     
         35        SEND_VAR                                                 $16
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Function str_split_unicode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 12
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 12
Branch analysis from position: 23
Branch analysis from position: 12
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uRnT3
function name:  str_split_unicode
number of ops:  32
compiled vars:  !0 = $str, !1 = $l, !2 = $ret, !3 = $len, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
    9     2        IS_SMALLER                                               0, !1
          3      > JMPZ                                                     ~5, ->24
   10     4    >   ASSIGN                                                   !2, <array>
   11     5        INIT_FCALL                                               'mb_strlen'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'UTF-8'
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !3, $7
   12    10        ASSIGN                                                   !4, 0
         11      > JMP                                                      ->21
   13    12    >   INIT_FCALL                                               'mb_substr'
         13        SEND_VAR                                                 !0
         14        SEND_VAR                                                 !4
         15        SEND_VAR                                                 !1
         16        SEND_VAL                                                 'UTF-8'
         17        DO_ICALL                                         $11     
         18        ASSIGN_DIM                                               !2
         19        OP_DATA                                                  $11
   12    20        ASSIGN_OP                                     1          !4, !1
         21    >   IS_SMALLER                                               !4, !3
         22      > JMPNZ                                                    ~13, ->12
   15    23    > > RETURN                                                   !2
   17    24    >   INIT_FCALL                                               'preg_split'
         25        SEND_VAL                                                 '%2F%2Fu'
         26        SEND_VAR                                                 !0
         27        SEND_VAL                                                 -1
         28        SEND_VAL                                                 1
         29        DO_ICALL                                         $14     
         30      > RETURN                                                   $14
   18    31*     > RETURN                                                   null

End of function str_split_unicode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.28 ms | 1403 KiB | 27 Q