Is it ok to do this please?
for($i=0;$i<strlen($str);$i++)
{
if(!in_array($str[$i],$arAllowedCharset)){$str[$i]='';}
}
return $str;
It works, but I am unsure if I am "allowed" to do that, i.e. $str[$i]='';.
Note: $str is a string variable, $arAllowedCharset is an array containing only alphanumerical characters and a dash.
I use that to format user-submitted URLs in a custom CMS.
Thank you.