How to explode a string, for instance
#heavy / machine gun #test
in order to only get heavy
and test
?
I tried with explode but so far I only got heavy / machine gun
and test
.
Alternative to explode:
$str = "#heavy / machine gun #test";
preg_match_all('/#([^\s]+)/', $str, $matches);
var_dump($matches[1]);
This will basically find all hashtags in a given string.