Skip to content

Instantly share code, notes, and snippets.

@BeauBouchard
Created February 16, 2017 19:48
Show Gist options
  • Save BeauBouchard/16a1c4b73438a19647bbc22b8506425a to your computer and use it in GitHub Desktop.
Save BeauBouchard/16a1c4b73438a19647bbc22b8506425a to your computer and use it in GitHub Desktop.
/**
* Sanitize Request variables
*/
public function sanitize($input) {
foreach ($input as $key => $value) {
if ($value) {
$input[$key] = filter_var($input[$key], FILTER_SANITIZE_STRING);
$input[$key] = preg_replace('/[^a-z0-9]/i', '', $input[$key]);
}
}
return $input;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment