RE: [PHP] "Trim" an array?

From: Date: Sat, 03 Feb 2001 16:23:47 +0000
Subject: RE: [PHP] "Trim" an array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37957@lists.php.net to get a copy of this message
a simple <snip> for($i=0; $i<sizeof($array); $++) $array[$i]=trim($array[$i]); </snip> will do the trick Cheers, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) maxim@phpbeginner.com www.phpbeginner.com -----Original Message----- From: Thomas Deliduka [mailto:thomas@neweve.com] Sent: Saturday, February 03, 2001 7:32 AM To: PHP List Subject: [PHP] "Trim" an array? 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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#37957) next »