Using preg_match_all() to Match a Pattern Globally$text = "plants, pianos and parrots";if ( preg_match_all( "/\bp\w+s\b/", $text, $array ) ) { print "\n"; print_r( $array ); print "\n";}?>
\n"; print_r( $array ); print "