<?php //當前頁面是utf8編碼 $str = '中文89PHP'; echo strlen($str)."<br/>"; //中文+數字+英文:6 + 2 + 3 = 11 echo mb_strlen($str, 'gbk')."<br/>"; //中文+數字+英文:3 + 2 + 3 = 8 echo mb_strlen($str, 'utf8')."<br/>"; //中文+數字+英文:2 + 2 + 3 = 7