Created
July 22, 2011 11:24
-
-
Save Andrew8xx8/1099275 to your computer and use it in GitHub Desktop.
Function to convert any string to string form only letters and digits.
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 generate_safe_name($name, $prefix = "") { | |
return strtolower((empty($prefix) ? "" : $prefix . "_") . preg_replace("%[^a-zA-Z0-9]%", "_", $name)); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment