3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = ['sr_no' => 72, 'batch_id' => 1]; $array2 = [ ['quantity' => 22, 'sr_no' => 71, 'batch_id' => 2, 'inq_id' => 91], ['quantity' => 35, 'sr_no' => 72, 'batch_id' => 1, 'inq_id' => 92], ['quantity' => 20, 'sr_no' => 69, 'batch_id' => 3, 'inq_id' => 90], ]; $result = null; foreach ($array2 as $row) { if (array_intersect_assoc($array1, $row) === $array1) { $result = $row; break; } } var_export($result);
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 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 14
Branch analysis from position: 14
filename:       /in/Gsigg
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result, !3 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
   12     2        ASSIGN                                                   !2, null
   13     3      > FE_RESET_R                                       $7      !1, ->14
          4    > > FE_FETCH_R                                               $7, !3, ->14
   14     5    >   INIT_FCALL                                               'array_intersect_assoc'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $8      
          9        IS_IDENTICAL                                             !0, $8
         10      > JMPZ                                                     ~9, ->13
   15    11    >   ASSIGN                                                   !2, !3
   16    12      > JMP                                                      ->14
   13    13    > > JMP                                                      ->4
         14    >   FE_FREE                                                  $7
   19    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:
142.39 ms | 1005 KiB | 15 Q