3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = ["Alice", "Bob", "Carol", "Dan", "Eve", "Frank", "Grace", "Heidi"]; $k = 4; $y = array_intersect_key($x, array_flip(array_rand($x, $k))); print_r($y);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AOS83
function name:  (null)
number of ops:  18
compiled vars:  !0 = $x, !1 = $k, !2 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 4
    5     2        INIT_FCALL                                               'array_intersect_key'
          3        SEND_VAR                                                 !0
          4        INIT_FCALL                                               'array_flip'
          5        INIT_FCALL                                               'array_rand'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                         $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                         $7      
         13        ASSIGN                                                   !2, $7
    6    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.07 ms | 1394 KiB | 21 Q