php Preg_replace_callback sorun

0 Cevap php

Merhaba aşağıdaki kodu var ama onlar da kafa karıştırıcı gibi Tescil exp değil büyük bir eğlenceli im:

<?php
$r = '|\\*(.+)\\*|'; 
$w = '';
$s = 'hello world *copyMe* here'; 
function callbk($str){
    print_r($str);
    foreach($str as $k=>$v) {
        echo $v;
    }
}
$t = preg_replace_callback($r,'callbk',$s);

//output: Array ( [0] => *copyMe* [1] => copyMe ) *copyMe*copyMe


?>

my question is why is there both "*copyMe*" and "copyMe"? i was hoping to get either one or the other, not both. any help would be appriciated.

0 Cevap