I have the following associative array:
Array
(
[0] => Array
(
[0] => 18-Jul-16
[1] => 29-Jul-15
[2] => 2-Feb-16
[3] => 3301
[4] => 1800 Bimodel
[5] => 5813
[6] => 1 800 Bimodel Multi-Option Test
[7] => Tested
[8] => Shop Center
[9] => Shop Services
[10] => 864
[11] => 20
[12] => 884
[13] => 0.75
[14] => 0.2
[15] => 0.49
[16] => 429.6
[17] => 47.3
[18] => 382.3
[19] =>
[20] => Jonas John
)
[1] => Array
(
[0] =>
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] =>
[10] =>
[11] =>
[12] =>
[13] =>
[14] =>
[15] =>
[16] =>
[17] =>
[18] =>
[19] =>
[20] =>
)
)
To filter out the empty array elements, I am using the following code:
$arrData = array_map('array_filter', $arrData);
$arrData = array_filter($arrData);
The above code removes all empty elements from the array. It also removes value at index 19 in the 0th array. I want it to remove array elements only if all the values of the array are empty. In my case only array at index 1 should be removed and the array at 0th index should not be removed (or any of its elements). I will always need 21 elements from each array. Can I do that selectively using php code ?
Thanks