Re: [PHP3] howto remove key/value from array based on regexp

From: Date: Tue, 11 Apr 2000 15:40:21 +0000
Subject: Re: [PHP3] howto remove key/value from array based on regexp
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-13389@lists.php.net to get a copy of this message
loop through putting them into another array and don't pass the empty ones. for ($x=0;$x<count($array);$x++) { if ($array[$x] meets whatever condition) $array2[] = $array[$x]; } Then if you need to you can pass them back to the original array Rossi Designs PO Box 1084 Holly Hill, FL 32125-1084 Phone : (904) 226-8979 URL : http://rossidesigns.net ----- Original Message ----- From: Dan Larsson <dl@tyfon.net> To: Php4beta (E-mail) <php4beta@lists.php.net>; [PHP-Users-List] (E-mail) <php3@lists.php.net> Sent: Tuesday, April 11, 2000 11:00 AM Subject: [PHP3] howto remove key/value from array based on regexp | My aim is to remove any keys where the values contain nothing but | spaces and/or newlines from an array. | | $array[0] = '123'; | $array[1] = ' '; | $array[2] = 'abc'; | | so that the above array becomes | | $array[0] = '123'; | $array[1] = 'abc'; | | Any ideas? | | Regards | ------------ | Dan Larsson | | | -- | PHP 3 Mailing List <http://www.php.net/> | To unsubscribe, send an empty message to php3-unsubscribe@lists.php.net | To subscribe to the digest, e-mail: php3-digest-subscribe@lists.php.net | To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 | To contact the list administrators, e-mail: php-list-admin@lists.php.net | |

« previous php.version4 (#13389) next »