colap Posted June 21, 2011 Share Posted June 21, 2011 How can remove those element with only white space or empty element? Quote 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. Quote 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 ) } Quote 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]); } } Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.