$str = '2*10*30 2x10x30';
$replace= 'R';
$pattern = array('/\d+(\*)/', '/\d+(x)/');
echo preg_filter($pattern, $replace, $str);
str_replace(['*','x'],'R','2*10*30 2x10x30');
preg_filter('/(\d+)[*x](\d+)[*x](\d+)/', '${1}R${2}R${3}', '2*10*30 2x10x30')