- preg_match_all: documentation ( source)
<?php
$string= "Went for an awesome bike ride today! #biking #awesome";
preg_match_all('/#(\w+)/',$string, $matches);
foreach ($matches[1] as $tag) {
echo $tag;
echo ", ";
}