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? Quote 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. Quote 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) Quote 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. Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/100470-foreach-_get/#findComment-513986 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.