3v4l.org

run code in 300+ PHP versions simultaneously
<?php $modules = ['redirect_404', 'redirect']; $modules_by_length = $modules; usort($modules_by_length, static fn ($a, $b) => strlen($b) - strlen($a)); $known_modules_pattern = implode('|', array_map( static fn ($x) => preg_quote($x, '/'), $modules_by_length, )); $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?<hook>[a-zA-Z0-9_\x80-\xff]+$))(?<!update_\d)(?<!update_\d\d)(?<!update_\d\d\d)(?<!update_\d\d\d\d)/'; print $module_preg; preg_match($module_preg, 'redirect_404_update_8101', $matches); preg_match($module_preg, 'redirect_404_cron', $matches); var_dump($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nh9IQ
function name:  (null)
number of ops:  35
compiled vars:  !0 = $modules, !1 = $modules_by_length, !2 = $known_modules_pattern, !3 = $module_preg, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, !0
    5     2        INIT_FCALL                                               'usort'
          3        SEND_REF                                                 !1
          4        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
          5        SEND_VAL                                                 ~7
          6        DO_ICALL                                                 
    6     7        INIT_FCALL                                               'implode'
          8        SEND_VAL                                                 '%7C'
          9        INIT_FCALL                                               'array_map'
    7    10        DECLARE_LAMBDA_FUNCTION                          ~9      [1]
         11        SEND_VAL                                                 ~9
    8    12        SEND_VAR                                                 !1
    6    13        DO_ICALL                                         $10     
    8    14        SEND_VAR                                                 $10
    6    15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !2, $11
   10    17        CONCAT                                           ~13     '%2F%5E%28%3F%3Cfunction%3E%28%3F%3Cmodule%3E', !2
         18        CONCAT                                           ~14     ~13, '%29_%28%3F%3Chook%3E%5Ba-zA-Z0-9_%5Cx80-%5Cxff%5D%2B%24%29%29%28%3F%3C%21update_%5Cd%29%28%3F%3C%21update_%5Cd%5Cd%29%28%3F%3C%21update_%5Cd%5Cd%5Cd%29%28%3F%3C%21update_%5Cd%5Cd%5Cd%5Cd%29%2F'
         19        ASSIGN                                                   !3, ~14
   11    20        ECHO                                                     !3
   12    21        INIT_FCALL                                               'preg_match'
         22        SEND_VAR                                                 !3
         23        SEND_VAL                                                 'redirect_404_update_8101'
         24        SEND_REF                                                 !4
         25        DO_ICALL                                                 
   13    26        INIT_FCALL                                               'preg_match'
         27        SEND_VAR                                                 !3
         28        SEND_VAL                                                 'redirect_404_cron'
         29        SEND_REF                                                 !4
         30        DO_ICALL                                                 
   14    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !4
         33        DO_ICALL                                                 
         34      > 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/Nh9IQ
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        STRLEN                                           ~2      !1
          3        STRLEN                                           ~3      !0
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
          6*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nh9IQ
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'preg_quote'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%2F'
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*     > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.56 ms | 1021 KiB | 19 Q