I would like to replace each \x to $matches[x] where x is a number.
It works only for predefined numbers with str_replace:
str_replace( array(
'\\1',
'\\2',
'\\3',
'\\4'
), array(
'$matches[1]',
'$matches[2]',
'$matches[3]',
'$matches[4]'
), $string );
preg_repalce()