3v4l.org

run code in 500+ PHP versions simultaneously
<?php $test = [ ['id' => 13, 'pets' => 8], ['id' => 15, 'pets' => 8], ['id' => 16, 'pets' => 10], ['id' => 17, 'pets' => 9], ['id' => 18, 'pets' => 10], ['id' => 19, 'pets' => 10], ['id' => 20, 'pets' => 0], ['id' => 21, 'pets' => 8], ['id' => 22, 'pets' => 9], ['id' => 23, 'pets' => 4], ['id' => 24, 'pets' => 0], ['id' => 40, 'pets' => 8], ['id' => 43, 'pets' => 2], ]; echo implode( ',', array_column( array_intersect_key( $test, array_flip(array_rand($test, 5)) ), 'id' ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7mSFX
function name:  (null)
number of ops:  19
compiled vars:  !0 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   21     1        INIT_FCALL                                                   'array_column'
   22     2        INIT_FCALL                                                   'array_intersect_key'
   23     3        SEND_VAR                                                     !0
   24     4        INIT_FCALL                                                   'array_flip'
          5        INIT_FCALL                                                   'array_rand'
          6        SEND_VAR                                                     !0
          7        SEND_VAL                                                     5
          8        DO_ICALL                                             $2      
          9        SEND_VAR                                                     $2
         10        DO_ICALL                                             $3      
         11        SEND_VAR                                                     $3
   22    12        DO_ICALL                                             $4      
   24    13        SEND_VAR                                                     $4
   26    14        SEND_VAL                                                     'id'
   21    15        DO_ICALL                                             $5      
   19    16        FRAMELESS_ICALL_2                implode             ~6      '%2C', $5
   26    17        ECHO                                                         ~6
   28    18      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.25 ms | 1331 KiB | 17 Q