Home >Backend Development >PHP Tutorial > 中文字符串取下标转换整数的有关问题

中文字符串取下标转换整数的有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:41:39847browse

中文字符串取下标转换整数的问题
已知php文件是utf8编码,现有如下内容:
$data = "中";
为什么(int)substr($data, 0, 1) == 0?
如何能转换成正确的整数?

PHP 编码 UTF-8
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