On Mon, 18 Aug 2003 08:03:25 -0400, you wrote: >How do I remove empty array values?
That could mean a lot of things. I'm going to assume you have a simple indexed array and want to remove any entries where array[index] == FALSE, and reindex the array. The most elegant way is to copy all the values you want to keep to a new array. $a = array(FALSE, 2, 3, FALSE, 5, FALSE, 7, FALSE, FALSE, FALSE); $b = array(); for ($i = 0; $i < sizeof ($a); $i++) { if ($a[$i] !== FALSE) { $b[] = $a[$i]; } } $a = $b; print_r ($a); If you don't want to reindex the array, you could use unset() $a = array(FALSE, 2, 3, FALSE, 5, FALSE, 7, FALSE, FALSE, FALSE); for ($i = 0; $i < sizeof ($a); $i++) { if ($a[$i] === FALSE) { unset ($a[$i]); } } print_r ($a); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php