"Trim" an array?

From: Date: Fri, 02 Feb 2001 22:31:43 +0000
Subject: "Trim" an array?
Groups: php.general 
Request: Send a blank email to php-general+get-37912@lists.php.net to get a copy of this message
I looked through the archives and couldn't find anything on this. I have a web form which takes 9 values to create a definition for a table that would have up to 9 columns. I made the table so that each form field is submitted as an array so that I can simply step through each value and create the table definition, so: <input type=text name="tblcol[]"> (duplicated 9 times) Now, when I submit the form the resulting array always has 9 elements and some of those will be empty. I would like to do error checking in case people didn't fill anything at all so I thought using if (!count($tblcol)) {.... But that doesn't work since it always has 9 elements. Is there a way to find out if an array contains no values even though it has elements? Sort of like a trim() function on an array to destroy the elements in the array that are empty. Is it possible? -- Thomas Deliduka IT Manager ------------------------- New Eve Media The Solution To Your Internet Angst http://www.neweve.com/

« previous php.general (#37912) next »