$array = [ 'a' => 'abc', 'aa' => 'abc', 'aaa' => 'abc', 'b' => 'bbc', 'c' => 'cbc', 'd' => 123, 1 => '123', 2 => 123 ]; $arr = array_keys($array,'123',false); echo ''; print_r($arr); result: Array ( [0] => d [1] => 1 [2] => 2 )