I think this feature will help you:
echo get_hashtags($string); function get_hashtags($string, $str = 1) { preg_match_all('/#(\w+)/',$string,$matches); $i = 0; if ($str) { foreach ($matches[1] as $match) { $count = count($matches[1]); $keywords .= "$match"; $i++; if ($count > $i) $keywords .= ", "; } } else { foreach ($matches[1] as $match) { $keyword[] = $match; } $keywords = $keyword; } return $keywords; }
Alvaro
source share