fork download
  1. <?php
  2.  
  3. $array['23']['sasdseqw'] = 'bla bla';
  4. $array['35']['sadasdsasa'] = '...dd';
  5. $array['21']['saadadass'] = 'ssddds';
  6. $array['15']['asadsadasas'] = 'adsdsas';
  7.  
  8. $keys = [21, 15];
  9. $result = array_intersect_key($array, array_flip($keys));
  10.  
  11. print_r($result);
Success #stdin #stdout 0.02s 20520KB
stdin
Standard input is empty
stdout
Array
(
    [21] => Array
        (
            [saadadass] => ssddds
        )

    [15] => Array
        (
            [asadsadasas] => adsdsas
        )

)