我需要使用PHP将文本输出到文件,尽管有些文本有&和½我无法确定那些是唯一的,因为文本块非常大。是否有一种非常简单的方法来获取包含这些类型的编码的字符串并将它们转换为各自的字符?
实施例
$str = "It rained 2& frac12 ; inches on friday. (ignore the spaces between & and ;)
当写入文件时,我希望文本阅读:
It rained 2½ inches on friday.
答案 0 :(得分:0)