Marthaj
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
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 :
And this is the structure of my array:$_SESSION['GlobalRegionIndex'] = 0;
$_SESSION['GlobalRegionArray'] = array();
$_SESSION['GlobalRegionArray'] = array(
'strRegionFile' => '',
'strRegionFileName' => '',
'strRegionProdLocation' => '',
'strRegionAwsLocation' => '',
'strRegionSupplierCode' => '',
'strRegionConfNbr' => '',
'strRegionStatus' =>'');
Any help/explanation is appreciated. Thank you in advance.
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
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.