RE: [PHP] foreach loop
| From: | PHPBeginner.com | Date: | Sat, 07 Jul 2001 17:09:47 +0000 |
| Subject: | RE: [PHP] foreach loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56647@lists.php.net to get a copy of this message | ||
actually the logic is follow:
every array has a key, therefore, you use:
foreach($variables as $key => $value) {
$variables[$key] = strip_tags($value);
$variables[$key] = AddSlashes($value);
}
where you get an array element with whatever key it uses, work on it's value
and assign it back with the original key, overriding it in other words.
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim@phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: John Meyer [mailto:john_meyer@geocities.com]
Sent: Sunday, July 08, 2001 2:32 AM
To: php-general@lists.php.net
Subject: [PHP] foreach loop
When I go through a foreach loop, are the values of the individual items in
the array changed?
For instance:
$variables = array($author_firstname, $author_lastname, $author_dob,
$author_dod, $author_bio);
foreach($variables as $value) {
$value = strip_tags($value);
$value =
AddSlashes($value);
}
will the values be changed outside of the loop?
John Meyer
john_meyer@geocities.com
Programmer
If we didn't have Microsoft, we'd have to blame ourselves for all of our
programs crashing
--
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