str_replace替换多个字符串

str_replace替换字符串

$str = 'abcde';
str_replace('a', 'c', $str);

‘a’ => ‘c’

==========================================

$str = '12345sdfasdf';
str_replace(['a', 'b'], 'c', $str);

‘a’ => ‘c’
‘b’ => ‘c’

==========================================

$str = 'dfgsdafgbsdfg';
str_replace(['a', 'b'], ['c', 'd'], $str);

‘a’ => ‘c’
‘b’ => ‘d’

你可能感兴趣的:(PHP)