3v4l.org

run code in 500+ 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:  32
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                                                   'array_map'
    7     8        DECLARE_LAMBDA_FUNCTION                              ~9      [1]
          9        SEND_VAL                                                     ~9
    8    10        SEND_VAR                                                     !1
    6    11        DO_ICALL                                             $10     
         12        FRAMELESS_ICALL_2                implode             ~11     '%7C', $10
         13        ASSIGN                                                       !2, ~11
   10    14        CONCAT                                               ~13     '%2F%5E%28%3F%3Cfunction%3E%28%3F%3Cmodule%3E', !2
         15        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'
         16        ASSIGN                                                       !3, ~14
   11    17        ECHO                                                         !3
   12    18        INIT_FCALL                                                   'preg_match'
         19        SEND_VAR                                                     !3
         20        SEND_VAL                                                     'redirect_404_update_8101'
         21        SEND_REF                                                     !4
         22        DO_ICALL                                                     
   13    23        INIT_FCALL                                                   'preg_match'
         24        SEND_VAR                                                     !3
         25        SEND_VAL                                                     'redirect_404_cron'
         26        SEND_REF                                                     !4
         27        DO_ICALL                                                     
   14    28        INIT_FCALL                                                   'var_dump'
         29        SEND_VAR                                                     !4
         30        DO_ICALL                                                     
         31      > 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:/in/Nh9IQ:5}
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:/in/Nh9IQ:7}
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.5.0


preferences:
173.58 ms | 1571 KiB | 18 Q