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)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: John Meyer [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 08, 2001 2:32 AM
To: [EMAIL PROTECTED]
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
[EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to