Link to home
Start Free TrialLog in
Avatar of Marthaj
MarthajFlag 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 Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

We'll need to see your data to give you proper advice, but array_filter can be used to filter multi-dimension arrays. You say your have a completely empty row, but arrays don't contain rows, so not sure what you're referring to.
ASKER CERTIFIED SOLUTION
Avatar of Marthaj
Marthaj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial