How do you remove the lines that have empty elements from a multidimensional-array in PHP?
For instance, from:
1: a, b, c, d
2: d, _, b, a
3: a, b, _, _
Use this code:
$source = array(
array('a', 'b', 'c', 'd'),
array('d', '_', 'b', 'a'),
array('a', 'b', '_', '_'),
array('d', 'c', 'b', 'a'),
array('_', 'b', 'c', 'd'),
array('d', 'c', 'b', 'a'),
);
$sourceCount = count($source);
for($i=0; $i<$sourceCount; $i++)
{
if(in_array("_", $source[$i])) unset($source[$i]);
}
See: http://ideone.com/Vfd6Z