<?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( $comps, $rests, fn($a, $b) => [$a['c_id'] ?? $a['r_id'], ($a['status'] ?? 'active') === 'active'] <=> [$b['c_id'] ?? $b['r_id'], ($b['status'] ?? 'active') === 'active'] ) );
You have javascript disabled. You will not be able to edit any code.