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, $i > $totalLength - $segmentLength ? $totalLength - $segmentLength : $i, $segmentLength ); } var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 6
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 6
Branch analysis from position: 23
Branch analysis from position: 6
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 6
Branch analysis from position: 23
Branch analysis from position: 6
filename:       /in/uGghH
function name:  (null)
number of ops:  27
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                                                      ->21
    7     6    >   INIT_FCALL                                               'substr'
    8     7        SEND_VAR                                                 !0
    9     8        SUB                                              ~11     !2, !1
          9        IS_SMALLER                                               ~11, !3
         10      > JMPZ                                                     ~12, ->14
         11    >   SUB                                              ~13     !2, !1
         12        QM_ASSIGN                                        ~14     ~13
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~14     !3
         15    >   SEND_VAL                                                 ~14
   10    16        SEND_VAR                                                 !1
    7    17        DO_ICALL                                         $15     
         18        ASSIGN_DIM                                               !4
   10    19        OP_DATA                                                  $15
    6    20        ASSIGN_OP                                     1          !3, !1
         21    >   IS_SMALLER                                               !3, !2
         22      > JMPNZ                                                    ~17, ->6
   13    23    >   INIT_FCALL                                               'var_export'
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.51 ms | 1002 KiB | 15 Q