Home  >  Article  >  Backend Development  >  string '??54' (length=8)用什么函数能转换成int类型的?解决思路

string '??54' (length=8)用什么函数能转换成int类型的?解决思路

WBOY
WBOYOriginal
2016-06-13 10:13:221000browse

string '??54' (length=8)用什么函数能转换成int类型的?
希望转换后的值仍为54.我试过intval和int,都不行,转换后都变成int0了。

------解决方案--------------------
估计是 bom头
var_dump(substr($str, 6));
------解决方案--------------------
$s = base64_decode('77u/77u/NTU=');
var_dump($s);

print_r(unpack('H*', $s));


string(8) "??55"
Array
(
[1] => efbbbfefbbbf3535
)

efbbbf 是 utf-8 编码文件的 BOM 头

你的数据是抓取的吧?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn