Php 将英文双引号转换为法文引号

Php 将英文双引号转换为法文引号,php,regex,Php,Regex,例如,如何在php中转换此字符串 $str = 'Hello world "some text"' 到 像这样: <?php $str = 'Hello world "some text"'; $regex = '/"(.*?)"/'; $subst = '«$1»'; $result = preg_replace($regex, $subst, $str); echo $result; ?> 到目前为止,您尝试了什么?我们在这里帮助您解答精确的问

例如,如何在php中转换此字符串

$str = 'Hello world "some text"'

像这样:

<?php
   $str = 'Hello world "some text"';
   $regex = '/"(.*?)"/';
   $subst = '«$1»';
   $result = preg_replace($regex, $subst, $str);
   echo $result;
?>


到目前为止,您尝试了什么?我们在这里帮助您解答精确的问题,而不是免费编写代码。
str\u replace()
preg\u replace()
将是一个开始。。。试一试,然后在你得到stuckcheck后回来实现这一点。可能重复的
u
修饰符可能对法语文本有意义,请删除结束php标记。。。
<?php
   $str = 'Hello world "some text"';
   $regex = '/"(.*?)"/';
   $subst = '«$1»';
   $result = preg_replace($regex, $subst, $str);
   echo $result;
?>