[PHP] Removing empty elements from an array

2002-04-28 Thread Craig Westerman
I have an array that contains several empty elements. What is simplest way to remove these elements? Array ( [0] = [1] = [2] = [3] = 16/Mar/02 [4] = [5] = 17/Mar/02 [6] = 18/Mar/02 [7] = 19/Mar/02 [8] = 20/Mar/02 [9] = 21/Mar/02 [10] = 22/Mar/02 [11] = 23/Mar/02 [12] = [13] = 24/Mar/02 [14] =

Re: [PHP] Removing empty elements from an array

2002-04-28 Thread Richard Emery
unset() ??? - Original Message - From: Craig Westerman [EMAIL PROTECTED] To: php-general-list [EMAIL PROTECTED] Sent: Sunday, April 28, 2002 9:36 AM Subject: [PHP] Removing empty elements from an array I have an array that contains several empty elements. What is simplest way

RE: [PHP] Removing empty elements from an array

2002-04-28 Thread Stuart Dallas
If $arr is your array, something like... foreach ($arr as $key=$val) { if (strlen($val) == 0) unset($arr[$key]); } HTH, Stuart -Original Message- From: Craig Westerman [mailto:[EMAIL PROTECTED]] Sent: 28 April 2002 15:37 To: php-general-list Subject: [PHP] Removing empty

Re: [PHP] Removing empty elements from an array

2002-04-28 Thread eric.coleman
Westerman [EMAIL PROTECTED] To: php-general-list [EMAIL PROTECTED] Sent: Sunday, April 28, 2002 10:36 AM Subject: [PHP] Removing empty elements from an array I have an array that contains several empty elements. What is simplest way to remove these elements? Array ( [0] = [1] = [2] = [3] = 16

RE: [PHP] Removing empty elements from an array

2002-04-28 Thread Matt Friedman
-list Subject: Re: [PHP] Removing empty elements from an array function filter($array) { if ( !is_array($array) ) { die(Must be an array!); } foreach($array as $key = $value) { if($array[$key] == ) { unset($array[$key