3v4l.org

run code in 500+ PHP versions simultaneously
<?php $pattern = '~^(?<animal>DOG|CAT)?(?<color>RED|BLUE)?$~i'; if ( preg_match($pattern, 'dog', $m) ) { $arr = ['animal' => '', 'color' => '']; print_r(array_intersect_key($m, $arr) + $arr); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/9Ci3u
function name:  (null)
number of ops:  17
compiled vars:  !0 = $pattern, !1 = $m, !2 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%7E%5E%28%3F%3Canimal%3EDOG%7CCAT%29%3F%28%3F%3Ccolor%3ERED%7CBLUE%29%3F%24%7Ei'
    4     1        INIT_FCALL                                                   'preg_match'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     'dog'
          4        SEND_REF                                                     !1
          5        DO_ICALL                                             $4      
          6      > JMPZ                                                         $4, ->16
    5     7    >   ASSIGN                                                       !2, <array>
    6     8        INIT_FCALL                                                   'print_r'
          9        INIT_FCALL                                                   'array_intersect_key'
         10        SEND_VAR                                                     !1
         11        SEND_VAR                                                     !2
         12        DO_ICALL                                             $6      
         13        ADD                                                  ~7      $6, !2
         14        SEND_VAL                                                     ~7
         15        DO_ICALL                                                     
    7    16    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
185.35 ms | 3354 KiB | 16 Q