3v4l.org

run code in 300+ PHP versions simultaneously
<?php $search = 'pink'; $test = array( 'name_01' => array('yellow', 'red', 'blue', 'black', 'white', 'purple'), 'name_02' => array('red', 'blue', 'white', 'green'), 'name_03' => array('blue', 'pink', 'purple', 'blue'), 'name_04' => array('white', 'black', 'red'), 'name_05' => array('yellow', 'white', 'pink', 'black') ); $keys = []; foreach($test as $key=>$arr){ if(in_array($search,$arr)){ $keys[] = $key; } } print_r($keys);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/8e0sj
function name:  (null)
number of ops:  19
compiled vars:  !0 = $search, !1 = $test, !2 = $keys, !3 = $arr, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'pink'
    5     1        ASSIGN                                                   !1, <array>
   13     2        ASSIGN                                                   !2, <array>
   14     3      > FE_RESET_R                                       $8      !1, ->14
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->14
          5    >   ASSIGN                                                   !4, ~9
   15     6        INIT_FCALL                                               'in_array'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $11     
         10      > JMPZ                                                     $11, ->13
   16    11    >   ASSIGN_DIM                                               !2
         12        OP_DATA                                                  !4
   14    13    > > JMP                                                      ->4
         14    >   FE_FREE                                                  $8
   19    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
134.07 ms | 998 KiB | 15 Q