str_replace複数文字列の置換
1139 ワード
str_置換文字列
‘a’ => ‘c’
==========================================
‘a’ => ‘c’ ‘b’ => ‘c’
==========================================
‘a’ => ‘c’ ‘b’ => ‘d’
$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’