3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unset_by_array_value(array $array, array $values) { $value_keys = array_flip($array); foreach ($values as $value) { if (isset($value_keys[$value])) { unset($array[$value_keys[$value]]); } } return $array; } $array = ['cheese', 'ham', 'bacon']; print_r(unset_by_array_value($array, ['ham']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hXrHr
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   16     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'unset_by_array_value'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function unset_by_array_value:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/hXrHr
function name:  unset_by_array_value
number of ops:  16
compiled vars:  !0 = $array, !1 = $values, !2 = $value_keys, !3 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'array_flip'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !2, $4
    5     6      > FE_RESET_R                                       $6      !1, ->13
          7    > > FE_FETCH_R                                               $6, !3, ->13
    6     8    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, !3
          9      > JMPZ                                                     ~7, ->12
    7    10    >   FETCH_DIM_R                                      ~8      !2, !3
         11        UNSET_DIM                                                !0, ~8
    5    12    > > JMP                                                      ->7
         13    >   FE_FREE                                                  $6
   11    14      > RETURN                                                   !0
   12    15*     > RETURN                                                   null

End of function unset_by_array_value

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.19 ms | 1399 KiB | 18 Q