preg_match_all searches a string for all the occurrences of a regular expression
<?php $s = 'A beautiful day'; preg_match_all ('/beaut[^ ]+/', $s, $matches); var_dump ($matches) ?>