3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'work', 'homework', 'home', 'sky', 'door' ]; $keep = ['work', 'home']; $lookup = array_combine($keep, $keep); foreach ($array as &$v) { $v = $lookup[$v] ?? 0; } var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/M3Q9d
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array, !1 = $keep, !2 = $lookup, !3 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   12     2        INIT_FCALL                                               'array_combine'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
   14     7      > FE_RESET_RW                                      $8      !0, ->14
          8    > > FE_FETCH_RW                                              $8, !3, ->14
   15     9    >   FETCH_DIM_IS                                     ~9      !2, !3
         10        COALESCE                                         ~10     ~9
         11        QM_ASSIGN                                        ~10     0
         12        ASSIGN                                                   !3, ~10
   14    13      > JMP                                                      ->8
         14    >   FE_FREE                                                  $8
   18    15        INIT_FCALL                                               'var_export'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.24 ms | 1011 KiB | 15 Q