3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '138201162401719'; $arr = str_split($str); $i = 0; while ($i < count($arr)) { $n = substr($str, $i, 2); echo $n."\n"; $firstchar = substr($n, 0, 1); if ($n < 26 && $firstchar != 0) { $result[] = substr($str, $i, 2); $i += 2; } else { $result[] = substr($str, $i, 1); $i++; } } echo implode(', ', $result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 7
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 35
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 7
Branch analysis from position: 46
Branch analysis from position: 7
Branch analysis from position: 25
filename:       /in/sVN1V
function name:  (null)
number of ops:  52
compiled vars:  !0 = $str, !1 = $arr, !2 = $i, !3 = $n, !4 = $firstchar, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '138201162401719'
    4     1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !1, $7
    6     5        ASSIGN                                                   !2, 0
    8     6      > JMP                                                      ->43
    9     7    >   INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !2
         10        SEND_VAL                                                 2
         11        DO_ICALL                                         $10     
         12        ASSIGN                                                   !3, $10
   10    13        CONCAT                                           ~12     !3, '%0A'
         14        ECHO                                                     ~12
   11    15        INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !3
         17        SEND_VAL                                                 0
         18        SEND_VAL                                                 1
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !4, $13
   12    21        IS_SMALLER                                       ~15     !3, 26
         22      > JMPZ_EX                                          ~15     ~15, ->25
         23    >   IS_NOT_EQUAL                                     ~16     !4, 0
         24        BOOL                                             ~15     ~16
         25    > > JMPZ                                                     ~15, ->35
   13    26    >   INIT_FCALL                                               'substr'
         27        SEND_VAR                                                 !0
         28        SEND_VAR                                                 !2
         29        SEND_VAL                                                 2
         30        DO_ICALL                                         $18     
         31        ASSIGN_DIM                                               !5
         32        OP_DATA                                                  $18
   14    33        ASSIGN_OP                                     1          !2, 2
         34      > JMP                                                      ->43
   16    35    >   INIT_FCALL                                               'substr'
         36        SEND_VAR                                                 !0
         37        SEND_VAR                                                 !2
         38        SEND_VAL                                                 1
         39        DO_ICALL                                         $21     
         40        ASSIGN_DIM                                               !5
         41        OP_DATA                                                  $21
   17    42        PRE_INC                                                  !2
    8    43    >   COUNT                                            ~23     !1
         44        IS_SMALLER                                               !2, ~23
         45      > JMPNZ                                                    ~24, ->7
   21    46    >   INIT_FCALL                                               'implode'
         47        SEND_VAL                                                 '%2C+'
         48        SEND_VAR                                                 !5
         49        DO_ICALL                                         $25     
         50        ECHO                                                     $25
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.06 ms | 1400 KiB | 19 Q