3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_slice($string, $offset) { return [substr($string, 0, $offset), substr($string, $offset)]; } $str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam aliquet.'; for($i = 0; $i < strlen($str); $i++) print_r(str_slice($str, $i));

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
Branch analysis from position: 3
filename:       /in/6ZcDM
function name:  (null)
number of ops:  15
compiled vars:  !0 = $str, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 'Lorem+ipsum+dolor+sit+amet%2C+consectetur+adipiscing+elit.+Aliquam+aliquet.'
   10     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->11
   11     3    >   INIT_FCALL                                               'print_r'
          4        INIT_FCALL                                               'str_slice'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
   10    10        PRE_INC                                                  !1
         11    >   STRLEN                                           ~7      !0
         12        IS_SMALLER                                               !1, ~7
         13      > JMPNZ                                                    ~8, ->3
   11    14    > > RETURN                                                   1

Function str_slice:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ZcDM
function name:  str_slice
number of ops:  15
compiled vars:  !0 = $string, !1 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'substr'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $2      
          7        INIT_ARRAY                                       ~3      $2
          8        INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $4      
         12        ADD_ARRAY_ELEMENT                                ~3      $4
         13      > RETURN                                                   ~3
    6    14*     > RETURN                                                   null

End of function str_slice

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.22 ms | 1015 KiB | 16 Q