3v4l.org

run code in 300+ PHP versions simultaneously
<?php $filename = '{date:Ymd:-4 day}trac{date2:Ymd:-1 day}king{date:Ymd:-1 day}'; $modifiers = array(); preg_match_all('|\{([^\}]+)\}|', $filename, $modifiers); foreach ($modifiers[1] as $id => $modifier) { $args = explode(':', $modifier); $method = array_shift($args); if ($method == 'date' && count($args)) { $replacement = count($args) == 2 ? date($args[0], strtotime($args[1])) : date($args[0]); $filename = str_replace($modifiers[0][$id], $replacement, $filename); } } echo $filename;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 54
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 54
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 53
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 39
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 53
Branch analysis from position: 24
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
filename:       /in/BcR3d
function name:  (null)
number of ops:  57
compiled vars:  !0 = $filename, !1 = $modifiers, !2 = $modifier, !3 = $id, !4 = $args, !5 = $method, !6 = $replacement
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7Bdate%3AYmd%3A-4+day%7Dtrac%7Bdate2%3AYmd%3A-1+day%7Dking%7Bdate%3AYmd%3A-1+day%7D'
    6     1        ASSIGN                                                   !1, <array>
    8     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%7C%5C%7B%28%5B%5E%5C%7D%5D%2B%29%5C%7D%7C'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !1
          6        DO_ICALL                                                 
   10     7        FETCH_DIM_R                                      ~10     !1, 1
          8      > FE_RESET_R                                       $11     ~10, ->54
          9    > > FE_FETCH_R                                       ~12     $11, !2, ->54
         10    >   ASSIGN                                                   !3, ~12
   11    11        INIT_FCALL                                               'explode'
         12        SEND_VAL                                                 '%3A'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $14     
         15        ASSIGN                                                   !4, $14
   12    16        INIT_FCALL                                               'array_shift'
         17        SEND_REF                                                 !4
         18        DO_ICALL                                         $16     
         19        ASSIGN                                                   !5, $16
   13    20        IS_EQUAL                                         ~18     !5, 'date'
         21      > JMPZ_EX                                          ~18     ~18, ->24
         22    >   COUNT                                            ~19     !4
         23        BOOL                                             ~18     ~19
         24    > > JMPZ                                                     ~18, ->53
   14    25    >   COUNT                                            ~20     !4
         26        IS_EQUAL                                                 ~20, 2
         27      > JMPZ                                                     ~21, ->39
         28    >   INIT_FCALL                                               'date'
         29        FETCH_DIM_R                                      ~22     !4, 0
         30        SEND_VAL                                                 ~22
         31        INIT_FCALL                                               'strtotime'
         32        FETCH_DIM_R                                      ~23     !4, 1
         33        SEND_VAL                                                 ~23
         34        DO_ICALL                                         $24     
         35        SEND_VAR                                                 $24
         36        DO_ICALL                                         $25     
         37        QM_ASSIGN                                        ~26     $25
         38      > JMP                                                      ->44
         39    >   INIT_FCALL                                               'date'
         40        FETCH_DIM_R                                      ~27     !4, 0
         41        SEND_VAL                                                 ~27
         42        DO_ICALL                                         $28     
         43        QM_ASSIGN                                        ~26     $28
         44    >   ASSIGN                                                   !6, ~26
   15    45        INIT_FCALL                                               'str_replace'
         46        FETCH_DIM_R                                      ~30     !1, 0
         47        FETCH_DIM_R                                      ~31     ~30, !3
         48        SEND_VAL                                                 ~31
         49        SEND_VAR                                                 !6
         50        SEND_VAR                                                 !0
         51        DO_ICALL                                         $32     
         52        ASSIGN                                                   !0, $32
   10    53    > > JMP                                                      ->9
         54    >   FE_FREE                                                  $11
   19    55        ECHO                                                     !0
         56      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.94 ms | 1400 KiB | 25 Q