PHP Grouping Captured Subpatterns – String Function

<?php
$todo = "
first=a
next=B
last=C
";preg_match_all("/([a-zA-Z]+)=(.*)/", $todo, $matches, PREG_SET_ORDER);foreach ($matches as $match) {
    print "The {$match[1]} action is {$match[2]} \n";
}
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.