3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = "Example-001"; $parts = explode("-",$str1); echo $parts[0] . "-" . str_pad($parts[1] + 1, 3, 0, STR_PAD_LEFT);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QYtSW
function name:  (null)
number of ops:  19
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        FETCH_DIM_R                                      ~5      !1, 0
          7        CONCAT                                           ~6      ~5, '-'
          8        INIT_FCALL                                               'str_pad'
          9        FETCH_DIM_R                                      ~7      !1, 1
         10        ADD                                              ~8      ~7, 1
         11        SEND_VAL                                                 ~8
         12        SEND_VAL                                                 3
         13        SEND_VAL                                                 0
         14        SEND_VAL                                                 0
         15        DO_ICALL                                         $9      
         16        CONCAT                                           ~10     ~6, $9
         17        ECHO                                                     ~10
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.47 ms | 1386 KiB | 17 Q