3v4l.org

run code in 500+ PHP versions simultaneously
<?php $strings = [ 'dir1summary', 'dir10summary', 'dir1summarydue', 'dir10summarydue', 'directive1', 'directive10', 'directivecode1', 'directivecode10', ]; var_export(preg_replace_callback('/dir(?:ective)?(\D*)(\d+)(.*)/', function ($m) { return "directive{$m[1]}{$m[3]}" . str_pad($m[2], 2, "0", STR_PAD_LEFT); }, $strings));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X6uGD
function name:  (null)
number of ops:  11
compiled vars:  !0 = $strings
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   13     1        INIT_FCALL                                                   'var_export'
          2        INIT_FCALL                                                   'preg_replace_callback'
          3        SEND_VAL                                                     '%2Fdir%28%3F%3Aective%29%3F%28%5CD%2A%29%28%5Cd%2B%29%28.%2A%29%2F'
          4        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
   15     5        SEND_VAL                                                     ~2
          6        SEND_VAR                                                     !0
   13     7        DO_ICALL                                             $3      
   15     8        SEND_VAR                                                     $3
   13     9        DO_ICALL                                                     
   15    10      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X6uGD
function name:  {closure:/in/X6uGD:13}
number of ops:  16
compiled vars:  !0 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
   14     1        ROPE_INIT                                         3  ~4      'directive'
          2        FETCH_DIM_R                                          ~1      !0, 1
          3        ROPE_ADD                                          1  ~4      ~4, ~1
          4        FETCH_DIM_R                                          ~2      !0, 3
          5        ROPE_END                                          2  ~3      ~4, ~2
          6        INIT_FCALL                                                   'str_pad'
          7        FETCH_DIM_R                                          ~6      !0, 2
          8        SEND_VAL                                                     ~6
          9        SEND_VAL                                                     2
         10        SEND_VAL                                                     '0'
         11        SEND_VAL                                                     0
         12        DO_ICALL                                             $7      
         13        CONCAT                                               ~8      ~3, $7
         14      > RETURN                                                       ~8
   15    15*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168 ms | 2142 KiB | 16 Q