I am using a script that builds images with text in them for buttons. I am creating a local file of the image with the button text as the name of the file.
Question: How do I replace all special characters that could be in the name (? ' \ / & # @ ect..) with underscores?
i.e. (Day/Date) to (Day_Date)
Thanks,
Don
Try:
$special_chars = \"?\'\\/&#@\"; $string = eregi_replace( \"[$special_chars]\", \"_\", $string );
or even
$string = eregi_replace( \"[[:alnum:]]\", \"_\", $string );
to replace all non-alphanumerics.
M