3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ "_token" => "62d46d4h6dfh841df8h", "sku62" => "3e", "name62" => "meh", "sku61" => "3e", "name61" => "mah", "sku64" => "3e", "name64" => "moh" ]; $array2 = [64, 74, 61]; var_export( array_intersect_ukey( $array1, array_flip($array2), fn($a, $b) => ltrim($a, 'a..z') <=> ltrim($b, 'a..z') ) ); echo "\n---\n"; $lookup = array_flip($array2); var_export( array_filter( $array1, fn($key) => isset($lookup[ltrim($key, 'a..z')]), ARRAY_FILTER_USE_KEY ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V5Ym6
function name:  (null)
number of ops:  30
compiled vars:  !0 = $array1, !1 = $array2, !2 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   15     2        INIT_FCALL                                               'var_export'
   16     3        INIT_FCALL                                               'array_intersect_ukey'
   17     4        SEND_VAR                                                 !0
   18     5        INIT_FCALL                                               'array_flip'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $5      
          8        SEND_VAR                                                 $5
   19     9        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
   20    10        SEND_VAL                                                 ~6
   16    11        DO_ICALL                                         $7      
   20    12        SEND_VAR                                                 $7
   15    13        DO_ICALL                                                 
   23    14        ECHO                                                     '%0A---%0A'
   25    15        INIT_FCALL                                               'array_flip'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !2, $9
   26    19        INIT_FCALL                                               'var_export'
   27    20        INIT_FCALL                                               'array_filter'
   28    21        SEND_VAR                                                 !0
   29    22        DECLARE_LAMBDA_FUNCTION                          ~11     [1]
         23        BIND_LEXICAL                                             ~11, !2
         24        SEND_VAL                                                 ~11
   30    25        SEND_VAL                                                 2
   27    26        DO_ICALL                                         $12     
   30    27        SEND_VAR                                                 $12
   26    28        DO_ICALL                                                 
   32    29      > 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/V5Ym6
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        INIT_FCALL                                               'ltrim'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'a..z'
          5        DO_ICALL                                         $2      
          6        INIT_FCALL                                               'ltrim'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 'a..z'
          9        DO_ICALL                                         $3      
         10        SPACESHIP                                        ~4      $2, $3
         11      > RETURN                                                   ~4
   20    12*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V5Ym6
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $key, !1 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'ltrim'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'a..z'
          5        DO_ICALL                                         $2      
          6        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !1, $2
          7      > RETURN                                                   ~3
          8*     > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.44 ms | 1011 KiB | 18 Q