<?php $comps = [ [ 'c_id' => '123', 'status' => 'active' ], [ 'c_id' => '456', 'status' => 'destroyed' ], [ 'c_id' => '789', 'status' => 'active' ] ]; $rests = [ [ 'r_id' => 123, 'extra' => 'some extra info for r_id 123' ], [ 'r_id' => 456, 'extra' => 'some extra info for r_id 456' ] ]; var_export( array_uintersect( array_filter($comps, function($row) { return $row['status'] === 'active'; }), $rests, function($a, $b) { return ($a['c_id'] ?? $a['r_id']) <=> ($b['c_id'] ?? $b['r_id']); } ) );
You have javascript disabled. You will not be able to edit any code.