PHP:将单引号字符串转换为双引号 [英] PHP: Convert single-quoted string into double-quoted

查看:561
本文介绍了PHP:将单引号字符串转换为双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将具有unicode \ xCODEs的字符串转换为常规字符串. 问题是我输入的字符串似乎是单引号.

I need to convert string with unicode \xCODEs into regular string. The issue is that string which I have as input seems to be single-quoted.

有什么方法可以将单引号字符串转换为双精度字符串?

Is there any way to convert single-quoted string into double?

这里有一些代码可以更好地理解:

$s1 = '(single quotes): Conductivity @ 20\xc3\x82\xc2\xb0C';
$s2 = "(double quotes): Conductivity @ 20\xc3\x82\xc2\xb0C";

echo "<br>";
echo iconv("UTF-8", "ISO-8859-1//IGNORE", $s1);
echo "<br>";
echo iconv("UTF-8", "ISO-8859-1//IGNORE", $s2);

将输出:

(single quotes): Conductivity @ 20\xc3\x82\xc2\xb0C
(double quotes): Conductivity @ 20°C

提前谢谢!

推荐答案

原来,我正在寻找脱衣舞会

非常感谢@mario!

Many thanks @mario!

这篇关于PHP:将单引号字符串转换为双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆