PHP下,截取中文字符串
来源:互联网 发布:seajs require其他js 编辑:程序博客网 时间:2024/04/30 03:08
One Chinese char inUFT-8 encoding holds 3 bytes, and let's suppose that your string is encoded by 'UTF-8', and you've already set your page's encoding method is 'UTF-8', then the following lines will make it:
$match->homegroup = '丙組';echo substr($match->homegroup, 0, 3); // works, will output '丙' , but not goodecho mb_substr($match->homegroup, 0, 3); // works, will output '丙' , but not goodecho mb_substr($match->homegroup, 0, 1, "UTF-8"); // works, will output '丙'
Just stop here, since it get the work done. And will be back soon!
REFs:
http://blog.xuite.net/chenbruse/bruse/13351768
http://blog.linym.net/archives/74
http://zoearthmoon.blogspot.com/2010/03/phpsubstr.html
http://www.wretch.cc/blog/herbjoyce/9665218
- PHP下,截取中文字符串
- php 截取中文字符串
- PHP截取中文字符串
- php截取中文字符串
- PHP截取中文字符串
- PHP截取中文字符串
- php截取中文字符串
- php中文字符串截取
- php 截取中文字符串
- php截取中文字符串
- PHP中文字符串截取
- 【php】截取中文字符串
- php中文字符串截取
- php截取中文字符串
- PHP 中文字符串截取
- php截取字符串(中文字符截取mb_substr)
- PHP中文字符串截取函数
- php的中文字符串截取
- .dll,.lib,.def 和 .exp文件
- 范围管理先行一步 项目管理学会说“不”
- Unable to execute dex: Java heap space 解决方案(如何为eclipse.int 添加内存)
- c语言指针数组
- 格式化XML文件,用msdn的工具
- PHP下,截取中文字符串
- WIN7 32位 破解 完美支持4G内存
- ffmpeg 内存 demo
- 谈VC++对象模型
- Powershell批量创建AD账户
- 超牛逼的芯片:无线数据传输速率将可高达30Gbps
- 计算机原理
- 选区的创建和编辑
- linux下LAMP环境搭建