How can I get rid of extra hyphens at the end and beginning of user submitted text for example. I want visual-studio-2008 instead of -visual-studio-2008- is there a way I can remove the extra hyphens using PHP?
views:
30answers:
3
A:
Use trim and have the second argument be a '-' character. That will remove the hyphens from the beginning and end of the string.
i.e. trim($string, '-')
For more: http://us3.php.net/trim
Siege898
2010-08-09 13:54:09