3v4l.org

run code in 300+ PHP versions simultaneously
<?php $my_array = array( 0 => array( "name" => "john", "id" => 4 ), 1 => array( "name" => "mark", "id" => 152 ), 2 => array( "name" => "Eduard", "id" => 152 ) ); $needle = 152; $keys = []; foreach ($my_array as $key => ['id' => $id]) { if ($needle === $id) { $keys[] = $key; } } var_export($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/XhoTS
function name:  (null)
number of ops:  19
compiled vars:  !0 = $my_array, !1 = $needle, !2 = $keys, !3 = $id, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, 152
   18     2        ASSIGN                                                   !2, <array>
   19     3      > FE_RESET_R                                       $8      !0, ->14
          4    > > FE_FETCH_R                                       ~12     $8, $9, ->14
          5    >   FETCH_LIST_R                                     $10     $9, 'id'
          6        ASSIGN                                                   !3, $10
          7        FREE                                                     $9
          8        ASSIGN                                                   !4, ~12
   20     9        IS_IDENTICAL                                             !1, !3
         10      > JMPZ                                                     ~14, ->13
   21    11    >   ASSIGN_DIM                                               !2
         12        OP_DATA                                                  !4
   19    13    > > JMP                                                      ->4
         14    >   FE_FREE                                                  $8
   24    15        INIT_FCALL                                               'var_export'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.91 ms | 1395 KiB | 15 Q