3

文字列があるとします

$string = 'this is my gal_s, not my 1_s not 2_s not 3_s';
$find = '_s';
$replace = '';

戻りたいです

"this is my gal_s, not my 1 not 2 not 3"

だから言葉gal_sは影響を受けない

これは可能ですか?

4

2 に答える 2

0

@anubhva answarも良い代替試行です

$string = 'this is my gal_s, not my 1_s not 2_s not 3_s';
$find = '_s';
$replace = '';
$arr = explode(',', $string);
$arr[1] = str_replace('_s', '', $arr[1]);
echo $string = implode($arr); 
于 2013-05-21T05:07:47.547 に答える