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? Link to comment https://forums.phpfreaks.com/topic/239273-filtering/ 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]? Link to comment https://forums.phpfreaks.com/topic/239273-filtering/#findComment-1229254 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.