Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- PHP regular expressions


andreasfriedrich - 10:55 pm on Aug 23, 2002 (gmt 0)


As mentioned in [php.net...] foreach works on a copy of the array. So

foreach ($HTTP_GET_VARS as $key=>$value) {
$value = stripstuff($value);
}

won´t work. But switching register_globals on is not the only way to directly use the modified values. There is a better way as you predicted yourself. And there is no need to assign them to vars at the beginning of your script or to use variable variable names.

All you need to do is:

foreach ($HTTP_GET_VARS as $key=>$value) {
$HTTP_GET_VARS[$key] = stripstuff($value);
}


Thread source:: http://www.webmasterworld.com/php/545.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com