3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'lognstring'; $segmentLength = 3; $totalLength = strlen($string); for ($i = 0; $i < $totalLength; $i += $segmentLength) { $result[] = substr( $string, min($totalLength - $segmentLength, $i), $segmentLength ); } var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 6
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 6
Branch analysis from position: 21
Branch analysis from position: 6
filename:       /in/2mkSm
function name:  (null)
number of ops:  25
compiled vars:  !0 = $string, !1 = $segmentLength, !2 = $totalLength, !3 = $i, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'lognstring'
    4     1        ASSIGN                                                   !1, 3
    5     2        STRLEN                                           ~7      !0
          3        ASSIGN                                                   !2, ~7
    6     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->19
    7     6    >   INIT_FCALL                                               'substr'
    8     7        SEND_VAR                                                 !0
    9     8        INIT_FCALL                                               'min'
          9        SUB                                              ~11     !2, !1
         10        SEND_VAL                                                 ~11
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $12     
         13        SEND_VAR                                                 $12
   10    14        SEND_VAR                                                 !1
    7    15        DO_ICALL                                         $13     
         16        ASSIGN_DIM                                               !4
   10    17        OP_DATA                                                  $13
    6    18        ASSIGN_OP                                     1          !3, !1
         19    >   IS_SMALLER                                               !3, !2
         20      > JMPNZ                                                    ~15, ->6
   13    21    >   INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.15 ms | 1002 KiB | 16 Q