conker87 Posted April 10, 2008 Share Posted April 10, 2008 Every $_GET value is passed through my sanitising function, however, I'm having to make variables for every time I use it. Could I use the foreach function? I can't test any code I make at the minute since I'm at work. Ex: <?php foreach($_GET as $getName => $getValue) { $_GET = san($getValue); } ?> Would this work? Link to comment https://forums.phpfreaks.com/topic/100470-foreach-_get/ Share on other sites More sharing options...
Daniel0 Posted April 10, 2008 Share Posted April 10, 2008 If you change it to $_GET[$getName] = san($getValue); then it would. Check out array_map() though. Link to comment https://forums.phpfreaks.com/topic/100470-foreach-_get/#findComment-513792 Share on other sites More sharing options...
conker87 Posted April 10, 2008 Author Share Posted April 10, 2008 So something like: $_GET = array_map("san", $_GET) Link to comment https://forums.phpfreaks.com/topic/100470-foreach-_get/#findComment-513923 Share on other sites More sharing options...
Daniel0 Posted April 10, 2008 Share Posted April 10, 2008 Yeah, that should work. You could try it out though. Link to comment https://forums.phpfreaks.com/topic/100470-foreach-_get/#findComment-513974 Share on other sites More sharing options...
conker87 Posted April 10, 2008 Author Share Posted April 10, 2008 Thanks a bunch, I shall try it when I stop working. I mean, go home. Link to comment https://forums.phpfreaks.com/topic/100470-foreach-_get/#findComment-513986 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.