3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "1,5"; $base = array('1'=>'Bread','5'=>'Butter'); $replacements = array_values( array_intersect_key( $base, array_flip( explode(',', $str)))); print_r( $replacements);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/49WJK
function name:  (null)
number of ops:  21
compiled vars:  !0 = $str, !1 = $base, !2 = $replacements
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '1%2C5'
    3     1        ASSIGN                                                   !1, <array>
    4     2        INIT_FCALL                                               'array_values'
          3        INIT_FCALL                                               'array_intersect_key'
          4        SEND_VAR                                                 !1
          5        INIT_FCALL                                               'array_flip'
          6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '%2C'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                         $8      
         16        ASSIGN                                                   !2, $8
    5    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.67 ms | 1386 KiB | 23 Q