3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = "Example-001"; $parts = explode("-",$str1); if($str1) echo sprintf($parts[0] . '-%03d', $parts[1]+1);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/ok530
function name:  (null)
number of ops:  17
compiled vars:  !0 = $str1, !1 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Example-001'
    5     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '-'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
    6     6      > JMPZ                                                     !0, ->16
    7     7    >   INIT_FCALL                                               'sprintf'
          8        FETCH_DIM_R                                      ~5      !1, 0
          9        CONCAT                                           ~6      ~5, '-%2503d'
         10        SEND_VAL                                                 ~6
         11        FETCH_DIM_R                                      ~7      !1, 1
         12        ADD                                              ~8      ~7, 1
         13        SEND_VAL                                                 ~8
         14        DO_ICALL                                         $9      
         15        ECHO                                                     $9
         16    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.08 ms | 1394 KiB | 17 Q