codrgii Posted June 13, 2011 Share Posted June 13, 2011 in php how am i able to filter all the $_GET varables without doing something like <? $_GET['varable1'] = filterfunctionhere($_GET['varable1']) $_GET['varable2'] = filterfunctionhere($_GET['varable2']) $_GET['varable3'] = filterfunctionhere($_GET['varable3']) $_GET['varable4'] = filterfunctionhere($_GET['varable4']) ?> but do something like <? $_GET['collect_all_1234varables_here'] = filterfunctionhere($_GET['collect_all_1234varables_here']) ?> how in php am i able to do that? and would someone explain what $_GET[0] would be used for? Quote Link to comment Share on other sites More sharing options...
requinix Posted June 13, 2011 Share Posted June 13, 2011 As long as you want to run filterfunctionhere on all elements in $_GET then you can use array_map. $getcopy = array_map("filterfunctionhere", $_GET); Note how that isn't overwriting $_GET. Avoid doing so with important variables like $_GET and $_POST. Now what's this about $_GET[0]? Quote Link to comment 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.