Avatar of Marthaj
Flag for United States of America

asked on 

Filtering a multi-dimensional Array in PHP

I have a multi-dimensional array that always contains one completely blank row.
How do I remove this one blank row?  The individual elements may or may not be blank.
If they all are blank (or null ?) then I want to get rid of that row.
 I have used array_filter on a one dimensional array,
but never for a  multi-dimensional array. I am not sure why I have a blank row, I check where and when I increment my index, and I think I am good.
Below are the two errors I receive
Notice: Uninitialized string offset

 Illegal string offset :

Open in new window

And this is the structure of my array:
$_SESSION['GlobalRegionIndex'] = 0;

$_SESSION['GlobalRegionArray'] = array();
$_SESSION['GlobalRegionArray'] = array(
                   'strRegionFile' => '',
         'strRegionFileName' => '',
         'strRegionProdLocation' => '',
         'strRegionAwsLocation' => '',
         'strRegionSupplierCode' => '',
         'strRegionConfNbr' => '',
         'strRegionStatus' =>'');

Open in new window

Any help/explanation is appreciated. Thank you in advance.

Avatar of undefined
Last Comment

8/22/2022 - Mon