3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stens = [ 'realistic' => [ 's1' => [10], 's2' => [11,12], 's3' => [13,14,15,16], 's4' => [17,18,19,20,21], 's5' => [22,23,24,25,26,27,28,29], 's6' => [30,31,32,33,34,35,36], 's7' => [37,48,39,40,41], 's8' => [42,43,44,45,46,47], 's9' => [48,49], 's10' => [50], ], 'research' => [ 's1' => [10,11,12,13,14], 's2' => [15], 's3' => [16,17,18,19,20], 's4' => [21,22,23,24,25,26,27,28], 's5' => [29,30,31,32,33], 's6' => [34,35,36,37,38], 's7' => [39,40,41,42], 's8' => [43,44,45,46,47], 's9' => [48,49], 's10' => [50], ], ]; $raw_data = [ 'realistic' => 18, 'research' => 43, ]; $result = []; foreach ($raw_data as $k => $v) { $result[$k] = array_find_key( $stens[$k], fn($s) => in_array($v, $s) ); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/tF8sM
function name:  (null)
number of ops:  22
compiled vars:  !0 = $stens, !1 = $raw_data, !2 = $result, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   30     1        ASSIGN                                                   !1, <array>
   35     2        ASSIGN                                                   !2, <array>
   36     3      > FE_RESET_R                                       $8      !1, ->17
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->17
          5    >   ASSIGN                                                   !4, ~9
   37     6        INIT_FCALL_BY_NAME                                       'array_find_key'
          7        CHECK_FUNC_ARG                                           
   38     8        FETCH_DIM_FUNC_ARG                               $12     !0, !4
          9        SEND_FUNC_ARG                                            $12
   39    10        DECLARE_LAMBDA_FUNCTION                          ~13     [0]
         11        BIND_LEXICAL                                             ~13, !3
   40    12        SEND_VAL_EX                                              ~13
   37    13        DO_FCALL                                      0  $14     
         14        ASSIGN_DIM                                               !2, !4
   40    15        OP_DATA                                                  $14
   36    16      > JMP                                                      ->4
         17    >   FE_FREE                                                  $8
   42    18        INIT_FCALL                                               'var_export'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
         21      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tF8sM
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $s, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'in_array'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   40     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.88 ms | 1007 KiB | 15 Q