Codice PHP:
/*$arrayIniziale... con chiavi [1]  [2]....

    [1] => Array
        (
            [0] => 
            [1] => 
            [2] => 
            [3] => 
            [4] => e
            [5] => f
        )

    [2] => Array
        (
            [0] => a
            [1] => b
            [2] => c
            [3] => d
            [4] => 
            [5] => 
        )
        
        */
    
$newArray = array();    
   foreach(
$arrayIniziale as $key=>$val){
       foreach(
$arrayIniziale[$key] as $key2=>$val2){
           if(
$val2!=''){
           
$newArray[]=$val2;        
           }
       } 
}