<?php
$array_1 = array(
'ana' => 'are',
'du' => 34,
'bopq'=> "Ana are mere mereu",
13 => "OK"
);
$array_2 = array('du', 13);
$result = array_intersect_key($array_1, array_flip($array_2));
Var_dump($result);
- Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- array(2) {
["du"]=>
int(34)
[13]=>
string(2) "OK"
}
preferences:
80.07 ms | 407 KiB | 5 Q