Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- php - Clean user input using preg_replace_callback and ord()?
- function replaceHTML ($match) {
- return "&#" . ord ($match[0]) . ";";
- }
- $clean = preg_replace_callback ( "/[^ a-zA-Z0-9]/", "replaceHTML", $userInput );
- $clean = preg_replace_callback('/[^a-z0-9s]/i', 'htmlentities', $userInput);
Add Comment
Please, Sign In to add comment