3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * * @param array $map * @param array $array * @return array */ function array_remap(array $map, array $array) { return array_combine(array_keys($map), array_map(function ($key) use ($array) { if (array_key_exists($key, $array)) { return $array[$key]; } return null; }, $map)); } var_dump(array_remap([ 'a' => 10, 'b' => 11, 'c' => 12, 'd' => 13, 'e' => 14, ], [ 10 => 'foo', 12 => 'bar', 14 => 'qux', ]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EPDYi
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'array_remap'
   20     2        SEND_VAL                                                 <array>
   26     3        SEND_VAL                                                 <array>
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   29     7      > RETURN                                                   1

Function array_remap:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EPDYi
function name:  array_remap
number of ops:  17
compiled vars:  !0 = $map, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_FCALL                                               'array_combine'
          3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        INIT_FCALL                                               'array_map'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEPDYi%3A11%240'
          9        BIND_LEXICAL                                             ~3, !1
   16    10        SEND_VAL                                                 ~3
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                         $5      
         15      > RETURN                                                   $5
   17    16*     > RETURN                                                   null

End of function array_remap

Function %00%7Bclosure%7D%2Fin%2FEPDYi%3A11%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EPDYi
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $key, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   12     2        ARRAY_KEY_EXISTS                                         !0, !1
          3      > JMPZ                                                     ~2, ->6
   13     4    >   FETCH_DIM_R                                      ~3      !1, !0
          5      > RETURN                                                   ~3
   15     6    > > RETURN                                                   null
   16     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FEPDYi%3A11%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.08 ms | 1403 KiB | 22 Q