使用注册商标访问数组键

3

我正在尝试使用键来访问数组值。我的代码运行良好,除非键中有注册商标。我该如何解决这个问题?

$map = array(
    'Education'=>'643',
    'STORMS®'=>'644',
);

print $csv_line[$i];        // prints STORMS®
print $map[$csv_line[$i]];  // prints nothing
print $map['STORMS®'];      // prints the value I need

1
我还没有复现这个问题。示例 如果在浏览器中显示正常,那么你可能得到的是(R) HTML实体而不是字符本身。 - Wiseguy
1个回答

0

这是HTML特殊字符,如果需要可以使用preg_replace或str_replace进行替换。

注册商标可以用®或®来表示。

特殊字符, htmlentities, normalizer


$Content = preg_replace("/&#?[a-z0-9]+;/i","",$Content);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接