3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "53" => "q", "61" => "f", "74" => "s", "87" => "C", "19" => "D", "101" => "e", "22" => "C", "13" => "h" ]; $whitelist = array_fill_keys(['C', 'D'], 0); $result = []; foreach ($array as $k => $v) { if (isset($whitelist[$v])) { if ($whitelist[$v]) { break; } ++$whitelist[$v]; } if (array_sum($whitelist)) { $result[] = $k; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 24
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 24
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 23
Branch analysis from position: 17
Branch analysis from position: 24
Branch analysis from position: 24
filename:       /in/nuDho
function name:  (null)
number of ops:  29
compiled vars:  !0 = $array, !1 = $whitelist, !2 = $result, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL                                               'array_fill_keys'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 0
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
   15     6        ASSIGN                                                   !2, <array>
   16     7      > FE_RESET_R                                       $9      !0, ->24
          8    > > FE_FETCH_R                                       ~10     $9, !3, ->24
          9    >   ASSIGN                                                   !4, ~10
   17    10        ISSET_ISEMPTY_DIM_OBJ                         0          !1, !3
         11      > JMPZ                                                     ~12, ->17
   18    12    >   FETCH_DIM_R                                      ~13     !1, !3
         13      > JMPZ                                                     ~13, ->15
   19    14    > > JMP                                                      ->24
   21    15    >   FETCH_DIM_RW                                     $14     !1, !3
         16        PRE_INC                                                  $14
   23    17    >   INIT_FCALL                                               'array_sum'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $16     
         20      > JMPZ                                                     $16, ->23
   24    21    >   ASSIGN_DIM                                               !2
         22        OP_DATA                                                  !4
   16    23    > > JMP                                                      ->8
         24    >   FE_FREE                                                  $9
   27    25        INIT_FCALL                                               'var_export'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.76 ms | 1013 KiB | 16 Q