3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "Dec 23 21:37:56 hello", "Jan 12 02:07:23 hello", "Jun 3 23:34:34 hello", "Dec 25 12:47:51 hello" ]; var_export( preg_replace_callback( '/^([a-z]{3}) +\d+/i', function($m) { static $encounteredJan = false; $encounteredJan = $encounteredJan || $m[1] === 'Jan'; return date('Y m d', strtotime($m[0] . ($encounteredJan ? '' : ' -1 year'))); }, $arr ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PfkAR
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'var_export'
   11     2        INIT_FCALL                                               'preg_replace_callback'
   12     3        SEND_VAL                                                 '%2F%5E%28%5Ba-z%5D%7B3%7D%29+%2B%5Cd%2B%2Fi'
   13     4        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   17     5        SEND_VAL                                                 ~2
   18     6        SEND_VAR                                                 !0
   11     7        DO_ICALL                                         $3      
   18     8        SEND_VAR                                                 $3
   10     9        DO_ICALL                                                 
   20    10      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/PfkAR
function name:  {closure}
number of ops:  22
compiled vars:  !0 = $m, !1 = $encounteredJan
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        BIND_STATIC                                              !1
   15     2      > JMPNZ_EX                                         ~2      !1, ->6
          3    >   FETCH_DIM_R                                      ~3      !0, 1
          4        IS_IDENTICAL                                     ~4      ~3, 'Jan'
          5        BOOL                                             ~2      ~4
          6    >   ASSIGN                                                   !1, ~2
   16     7        INIT_FCALL                                               'date'
          8        SEND_VAL                                                 'Y+m+d'
          9        INIT_FCALL                                               'strtotime'
         10        FETCH_DIM_R                                      ~6      !0, 0
         11      > JMPZ                                                     !1, ->14
         12    >   QM_ASSIGN                                        ~7      ''
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~7      '+-1+year'
         15    >   CONCAT                                           ~8      ~6, ~7
         16        SEND_VAL                                                 ~8
         17        DO_ICALL                                         $9      
         18        SEND_VAR                                                 $9
         19        DO_ICALL                                         $10     
         20      > RETURN                                                   $10
   17    21*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.11 ms | 1002 KiB | 17 Q