PHP Pass Fourth Parameter To Preg_Replace( ) To Specify Maximum Number Of Replacements You Want To Make. – String Function

<?
    $a = "Foo moo boo tool foo";
    $b = preg_replace("/[A-Za-z]oo\b/e", 'strtoupper("$0")', $a, 2);
    print $b;
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.