preg_replace başarılı ya da değil

0 Cevap

Bir preg_replace veya başarılı olup olmadığını söylemek için herhangi bir yolu var mı?

Denedim:

<?php

$stringz = "Dan likes to eat pears and his favorite color is green and green!";
$patterns = array("/pears/","/green/", "/red/");

if ($string = preg_replace($patterns, '<b>\\0</b>', $stringz, 1)) {
echo "<textarea rows='30' cols='100'>$string</textarea>";
}else{
    echo "Nope. You didn't have all the required patterns in the array.";
    }

?>

ve evet, ben bu bir php dokümanlar baktı. Önce benim aptal sorular için üzgünüm.

0 Cevap