3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string= "Hi #geeting #shortAnswer #notUseful"; preg_match_all('/#(\w+)/',$string, $matches); echo "The matches:\n"; foreach ($matches[1] as $tag) { echo $tag."\n"; } echo "\n\nThe array \$matches:\n"; var_dump($matches);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
The matches: geeting shortAnswer notUseful The array $matches: array(2) { [0]=> array(3) { [0]=> string(8) "#geeting" [1]=> string(12) "#shortAnswer" [2]=> string(10) "#notUseful" } [1]=> array(3) { [0]=> string(7) "geeting" [1]=> string(11) "shortAnswer" [2]=> string(9) "notUseful" } }