3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ 0 => 'pens', 1 => 'paper', 2 => 'pencils', 3 => 'lead', 4 => 'trashcans', 5 => 'cars', ]; $string = '2,3,5'; var_dump(implode(',', array_intersect_key($array, array_flip(explode(',', $string)))));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HQ7GB
function name:  (null)
number of ops:  18
compiled vars:  !0 = $array, !1 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   11     1        ASSIGN                                                       !1, '2%2C3%2C5'
   13     2        INIT_FCALL                                                   'var_dump'
          3        INIT_FCALL                                                   'array_intersect_key'
          4        SEND_VAR                                                     !0
          5        INIT_FCALL                                                   'array_flip'
          6        INIT_FCALL                                                   'explode'
          7        SEND_VAL                                                     '%2C'
          8        SEND_VAR                                                     !1
          9        DO_ICALL                                             $4      
         10        SEND_VAR                                                     $4
         11        DO_ICALL                                             $5      
         12        SEND_VAR                                                     $5
         13        DO_ICALL                                             $6      
         14        FRAMELESS_ICALL_2                implode             ~7      '%2C', $6
         15        SEND_VAL                                                     ~7
         16        DO_ICALL                                                     
         17      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.17 ms | 1756 KiB | 17 Q