3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = ["Key1" => "1", "Key2" => "22, 4, 123"]; $array2 = [ ["ID" => "1", "Name" => "Name1"], ["ID" => "22", "Name" => "Name22"], ["ID" => "123", "Name" => "Name123"] ]; $lookup = array_column($array2, 'Name', 'ID'); var_export( preg_replace_callback( '/\d+/', fn($m) => $lookup[$m[0]] ?? $m[0], $array1 ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADMZP
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array1, !1 = $array2, !2 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
   10     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 'Name'
          5        SEND_VAL                                                 'ID'
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !2, $5
   11     8        INIT_FCALL                                               'var_export'
   12     9        INIT_FCALL                                               'preg_replace_callback'
   13    10        SEND_VAL                                                 '%2F%5Cd%2B%2F'
   14    11        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         12        BIND_LEXICAL                                             ~7, !2
         13        SEND_VAL                                                 ~7
   15    14        SEND_VAR                                                 !0
   12    15        DO_ICALL                                         $8      
   15    16        SEND_VAR                                                 $8
   11    17        DO_ICALL                                                 
   17    18      > 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/ADMZP
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $m, !1 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_R                                      ~2      !0, 0
          3        FETCH_DIM_IS                                     ~3      !1, ~2
          4        COALESCE                                         ~4      ~3
          5        FETCH_DIM_R                                      ~5      !0, 0
          6        QM_ASSIGN                                        ~4      ~5
          7      > RETURN                                                   ~4
          8*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.81 ms | 1005 KiB | 16 Q