Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * conver string to hastag
- * @param string $string string you want to convert
- * @param boolean $with_hashtag if false, it won't return the # sign
- * @return string Eureka! you got your #hashtag!
- */
- function stringToHashtag($string, $with_hashtag = true)
- {
- $_string = str_replace(' ', '', $string);
- $_out = preg_replace('/[^a-zA-Z]/', '', strtolower($_string));
- return ($with_hashtag) ? "#". $_out : $_out ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement