3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['work', 'homework', 'home', 'sky', 'door']; $keep = ['work', 'home']; $lookup = array_combine($keep, $keep); var_export( array_map(fn($v) => $lookup[$v] ?? 0, $array) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eWOPC
function name:  (null)
number of ops:  17
compiled vars:  !0 = $array, !1 = $keep, !2 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_combine'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   10     7        INIT_FCALL                                               'var_export'
   11     8        INIT_FCALL                                               'array_map'
          9        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         10        BIND_LEXICAL                                             ~7, !2
         11        SEND_VAL                                                 ~7
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $8      
         14        SEND_VAR                                                 $8
   10    15        DO_ICALL                                                 
   12    16      > 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/eWOPC
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v, !1 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_IS                                     ~2      !1, !0
          3        COALESCE                                         ~3      ~2
          4        QM_ASSIGN                                        ~3      0
          5      > RETURN                                                   ~3
          6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.15 ms | 1439 KiB | 16 Q