im trying to remove only the empty array
Array
(
[test1] => test1
[test2] => test2
[test3] =>
)
i have tried the following :
$array = array_filter(array_map('array_filter', $array));
and
foreach( $array as $key => $value ) {
if( is_array( $value ) ) {
foreach( $value as $key2 => $value2 ) {
if( empty( $value2 ) )
unset( $array[ $key ][ $key2 ] );
}
}
if( empty( $array[ $key ] ) )
unset( $array[ $key ] );
}
also i have tried to avoid adding any empty array :
foreach($attributes_array as $key => $single_attribute){
if(!empty($attributes_array)){
$attributes[$attributes_array[$key]['attribute_name']] = $attributes_array[$key] ['attribute_value'];
}
}
any of the following code wont work in my case, any other possible soultion?