My array is of following structure. It is a array of files submitted through form. I have multiple input fields for form. However if the user leave some field blank, the array will be displayed like below. I am then writing it to my database. I dont want the empty fields to be written.
I tried using array_filter()
function, but it will not work since my array is not completely empty. The error element is set to 4
. How do i do it?
Array
(
[0] => Array
(
[name] => stock-photo-cup-icons-tea-and-coffee-raster-version-109119257.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpqWWM9X
[error] => 0
[size] => 30609
)
[1] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
[2] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
[3] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
)