Now the fastest way to do this would be with an SQL SELECT statment but as this is not possible I need to have reasonable speed even with big arrays

Belo are my functions which are logically simple. However is there a way of getting the same results but less processor cycles?

PHP Code:
    // returns array
    
function all_x_where_y_equals($x$y$val$from){
        
$new = array();
        foreach (
$from as $fr){
            if (
$fr[$y] == $val){
                
$new[] = $fr[$x]
            }
        }
        return 
$new;
    }
    
    
// returns array
    
function all_keys_where_y_equals($y$val$from){
        
$new = array();
        foreach (
$from as $k => $fr){
            if (
$fr[$y] == $val){
                
$new[] = $k
            
}
        }
        return 
$new;
    }