RE: [PHP] Array Cleansing
| From: | Cal Evans | Date: | Fri, 23 Mar 2001 16:05:06 +0000 |
| Subject: | RE: [PHP] Array Cleansing | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45301@lists.php.net to get a copy of this message | ||
One way to do it is to spin through the original array using a for/next loop
and build a second array of only the rows you want to keep. Then, rename the
new array to the old array. ($oldArray = $newArray;)
Cal
http://www.calevans.com
-----Original Message-----
From: pkshifted@slackin.com [mailto:pkshifted@slackin.com]
Sent: Friday, March 23, 2001 10:01 AM
To: php-general@lists.php.net
Subject: [PHP] Array Cleansing
Maybe someone could help with this? I'm trying to remove white space values
from my array, and resequence them, so that the following:
foo[0] = "value",
foo[1] = " ",
foo[2] = "value",
foo[3] = " ",
foo[4] = "value"
after running through a piece of code would turn into
foo[0] = "value",
foo[1] = "value",
foo[2] = "value",
foo[3] = null,
foo[4] = null,
The code I wrote, and deleted out of frustration ended up with all of the
variables equal to null. Maybe someone could show me the proper way?
PKshifted
--
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