Last active
June 30, 2024 14:36
-
-
Save trikitrok/46d9c0d5944221528dac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Sanitizer | |
{ | |
public static function sanitizeString($str) | |
{ | |
$str = stripSlashes($str); | |
$str = htmlentities($str); | |
return strip_tags($str); | |
} | |
public static function sanitizeArray($input) | |
{ | |
return array_map( | |
// Sanitizer::sanitizeString or self::sanitizeString don't work | |
// but all these different ways would: | |
// array('Sanitizer','sanitizeString'), | |
//'Sanitizer::sanitizeString', | |
//array('self','sanitizeString'), | |
'self::sanitizeString', | |
$input | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment