3v4l.org

run code in 300+ PHP versions simultaneously
<?php $assoc_array = array( array( 'firstname' => 'John', 'lastname' => 'Doe', 'age' => 26 ), array( 'firstname' => 'Sophia', 'lastname' => 'Smith', 'age' => 30 ) ); $array = array( 'firstname' => 'John', 'lastname' => 'Doe' ); foreach($assoc_array as $sub){ $match = array_intersect($sub, $array); if($match) $new[] = $sub; } var_dump($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/enaXb
function name:  (null)
number of ops:  18
compiled vars:  !0 = $assoc_array, !1 = $array, !2 = $sub, !3 = $match, !4 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, <array>
   20     2      > FE_RESET_R                                       $7      !0, ->13
          3    > > FE_FETCH_R                                               $7, !2, ->13
   21     4    >   INIT_FCALL                                               'array_intersect'
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !3, $8
   22     9      > JMPZ                                                     !3, ->12
         10    >   ASSIGN_DIM                                               !4
         11        OP_DATA                                                  !2
   20    12    > > JMP                                                      ->3
         13    >   FE_FREE                                                  $7
   24    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !4
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
128.56 ms | 1399 KiB | 17 Q