如何在php中转换代码的十进制值


How to convert code decimal value in php

我有一个带Code Decimal的字符串,希望像这样转换:

当前刺痛:

24⃧ Guage Rake;

并且想要像这样转换:

24" Guage Rake

我尝试过这个,但没有得到正确的结果:

$string = "hello&#8423";
htmlspecialchars_decode($string, ENT_NOQUOTES);

有什么想法吗?

感谢

htmlspecialchars_decode()只更改一些字符,如引号。

您需要使用html_entity_decode()。此外,"hello&#8423"缺少分号。应为"hello⃧""hello″"

试试这个:

header("Content-Type: text/plain; charset=UTF8");
$string = "hello″";
$string = html_entity_decode($string, ENT_NOQUOTES);
echo $string;

尝试使用html_entity_decode:

<?php
$string = '24 - your entity: ->  &#8243; <- -  Guage Rake;';
$decoded = html_entity_decode($string);
echo "$decoded'n";