3v4l.org

run code in 300+ PHP versions simultaneously
<?php function c_substr($string, $from, $length = null){ preg_match_all('/[x80-xff]?./', $string, $match); if(is_null($length)){ $result = implode('', array_slice($match[0], $from)); }else{ $result = implode('', array_slice($match[0], $from, $length)); } return $result; } $str = "zhon华人min共和guo"; $from = 3; $length = 7; echo(c_substr($str, $from, $length));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6S8UW
function name:  (null)
number of ops:  10
compiled vars:  !0 = $str, !1 = $from, !2 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, 'zhon%E5%8D%8E%E4%BA%BAmin%E5%85%B1%E5%92%8Cguo'
   12     1        ASSIGN                                                   !1, 3
   13     2        ASSIGN                                                   !2, 7
   14     3        INIT_FCALL                                               'c_substr'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_FCALL                                      0  $6      
          8        ECHO                                                     $6
          9      > RETURN                                                   1

Function c_substr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6S8UW
function name:  c_substr
number of ops:  34
compiled vars:  !0 = $string, !1 = $from, !2 = $length, !3 = $match, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
    3     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAL                                                 '%2F%5Bx80-xff%5D%3F.%2F'
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !3
          7        DO_ICALL                                                 
    4     8        TYPE_CHECK                                    2          !2
          9      > JMPZ                                                     ~6, ->21
    5    10    >   INIT_FCALL                                               'implode'
         11        SEND_VAL                                                 ''
         12        INIT_FCALL                                               'array_slice'
         13        FETCH_DIM_R                                      ~7      !3, 0
         14        SEND_VAL                                                 ~7
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                         $9      
         19        ASSIGN                                                   !4, $9
         20      > JMP                                                      ->32
    7    21    >   INIT_FCALL                                               'implode'
         22        SEND_VAL                                                 ''
         23        INIT_FCALL                                               'array_slice'
         24        FETCH_DIM_R                                      ~11     !3, 0
         25        SEND_VAL                                                 ~11
         26        SEND_VAR                                                 !1
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $12     
         29        SEND_VAR                                                 $12
         30        DO_ICALL                                         $13     
         31        ASSIGN                                                   !4, $13
    9    32    > > RETURN                                                   !4
   10    33*     > RETURN                                                   null

End of function c_substr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.85 ms | 1403 KiB | 20 Q