PHP Using Preg_Match_All() To Match Pattern Globally – String Function

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

\n”;
}
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.