1 2 3 4 5 6 7 8 9 10 11 12
<?php $tweet = "Foo bar #hashTag hello world"; $hashPos = strpos($tweet,'#'); $hashTag = ''; while ($tweet[$hashPos] !== ' ') { $hashTag .= $tweet[$hashPos++]; } echo $hashTag;
1
#hashTag