Created
March 28, 2018 15:43
-
-
Save sdfsdhgjkbmnmxc/0b7106efc96b582987ffd75bf906f7e4 to your computer and use it in GitHub Desktop.
This file contains 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
function clean_title($s, $max_chars=64) { | |
$result = ''; | |
$arr = str_split($s); | |
$allowed_chars = str_split('0123456789"(),.:;- йцукенгшщзхъфывапролджэёячсмитьбюqwertyuiopasdfghjklzxcvbnm'); | |
foreach ($arr as $char) { | |
if (len($result) >= $max_chars) { | |
break; | |
} | |
if (in_array(strtolower($char), $allowed_chars)) { | |
$result += $char; | |
} | |
} | |
return $result; | |
} |
dimaninc
commented
Mar 28, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment