Skip to content Skip to sidebar Skip to footer

Get Hashtag From String And Get Into Meta Keywords And Tags

I'm creating a kind of a blog sharing link. Basically, for each link i would extract hashtag from post string and put it into a meta tags and keywords. So, string normally is like

Solution 1:

Do you mean something like this:

$str = '#helloworld #test #video #youtube Bon Iver are the best daily surprise :D';

preg_match_all('/#([^\s]+)/', $str, $matches);

$hashtags = implode(',', $matches[1]);

var_dump($hashtags);

Post a Comment for "Get Hashtag From String And Get Into Meta Keywords And Tags"