- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$string= "Hi #geeting #shortAnswer #notUseful";
preg_match_all('/#(\w+)/',$string, $matches);
echo "The matches:\n";
foreach ($matches[1] as $tag) {
echo $tag."\n";
}
var_dump($matches);