3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.64 ms | 1396 KiB | 25 Q