3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '022906032KC_1282', '022906032KE_0871', '022906032LA_1056', '1K0035188F_DE2_0008', '1K0035188F_DE2_0008', '1K0035188F_DE2_0008', '1K0035188F_DE2_0008', ]; $pattern = '/^(?<prefix>[a-z0-9]+)(?<number>_\w+)$/ui'; var_dump(array_map(static function (string $name) use ($pattern) { preg_match($pattern, $name, $match); $prefix = $match['prefix'] ?? ''; $number = $match['number'] ?? ''; if ('' === $prefix || '' === $number) { return []; } return [ $prefix, $number, ]; }, $array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fEeJg
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array, !1 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, '%2F%5E%28%3F%3Cprefix%3E%5Ba-z0-9%5D%2B%29%28%3F%3Cnumber%3E_%5Cw%2B%29%24%2Fui'
   14     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'array_map'
          4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
   28     6        SEND_VAL                                                 ~4
          7        SEND_VAR                                                 !0
   14     8        DO_ICALL                                         $5      
   28     9        SEND_VAR                                                 $5
   14    10        DO_ICALL                                                 
   28    11      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/fEeJg
function name:  {closure}
number of ops:  25
compiled vars:  !0 = $name, !1 = $pattern, !2 = $match, !3 = $prefix, !4 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   15     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   17     7        FETCH_DIM_IS                                     ~6      !2, 'prefix'
          8        COALESCE                                         ~7      ~6
          9        QM_ASSIGN                                        ~7      ''
         10        ASSIGN                                                   !3, ~7
   18    11        FETCH_DIM_IS                                     ~9      !2, 'number'
         12        COALESCE                                         ~10     ~9
         13        QM_ASSIGN                                        ~10     ''
         14        ASSIGN                                                   !4, ~10
   20    15        IS_IDENTICAL                                     ~12     !3, ''
         16      > JMPNZ_EX                                         ~12     ~12, ->19
         17    >   IS_IDENTICAL                                     ~13     !4, ''
         18        BOOL                                             ~12     ~13
         19    > > JMPZ                                                     ~12, ->21
   21    20    > > RETURN                                                   <array>
   25    21    >   INIT_ARRAY                                       ~14     !3
   26    22        ADD_ARRAY_ELEMENT                                ~14     !4
         23      > RETURN                                                   ~14
   28    24*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.02 ms | 1007 KiB | 16 Q