colap Posted June 21, 2011 Share Posted June 21, 2011 How can remove those element with only white space or empty element? Link to comment https://forums.phpfreaks.com/topic/239946-how-can-i-remove-empty-element-or-element-with-no-a-za-z0-9-from-a-array/ Share on other sites More sharing options...
Xtremer360 Posted June 21, 2011 Share Posted June 21, 2011 Removing an element could only be done on the client side I suggest looking into jQuery. Link to comment https://forums.phpfreaks.com/topic/239946-how-can-i-remove-empty-element-or-element-with-no-a-za-z0-9-from-a-array/#findComment-1232562 Share on other sites More sharing options...
colap Posted June 21, 2011 Author Share Posted June 21, 2011 Array ( [0] => Array ( [0] => ubuntu [1] => [2] => apache ) } I want to remove [0][1] element then the new array will be Array ( [0] => Array ( [0] => ubuntu [1] => apache ) } Link to comment https://forums.phpfreaks.com/topic/239946-how-can-i-remove-empty-element-or-element-with-no-a-za-z0-9-from-a-array/#findComment-1232566 Share on other sites More sharing options...
Pikachu2000 Posted June 21, 2011 Share Posted June 21, 2011 @CoolAsCarlito - How on earth do you figure that? Use a foreach() loop, a conditional and unset(). foreach( $array as $k => $v ) { $v = trim($v); if( empty($v) ) { unset($array[$k]); } } Link to comment https://forums.phpfreaks.com/topic/239946-how-can-i-remove-empty-element-or-element-with-no-a-za-z0-9-from-a-array/#findComment-1232567 Share on other sites More sharing options...
Xtremer360 Posted June 21, 2011 Share Posted June 21, 2011 I apologize with really lack of information I misinterpreted what he wanted. Link to comment https://forums.phpfreaks.com/topic/239946-how-can-i-remove-empty-element-or-element-with-no-a-za-z0-9-from-a-array/#findComment-1232572 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.