Jump to content

filtering?


codrgii

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.