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);

preferences:
28.19 ms | 405 KiB | 5 Q