- Impact
- 3,210
I'm looking for the most efficient function that I can give a string and have it return the same string without the invalid characters. Its for a domain related application so only alphanumeric and hyphens are valid.
Example:
$string = cleanstring("test_ing"); # returns "testing"
$string = cleanstring("t@e#s%t i*n^g"); # returns "testing"
$string = cleanstring("test-ing"); # returns "test-ing"
Suggestions?
Example:
$string = cleanstring("test_ing"); # returns "testing"
$string = cleanstring("t@e#s%t i*n^g"); # returns "testing"
$string = cleanstring("test-ing"); # returns "test-ing"
Suggestions?















