background image

 

<?php

//判断内容里有没有中文-GBK (PHP)
function

 check_is_chinese(

$s

){

return

 preg_match(‘/[\x80-\xff]./’, 

$s

);

}

 

 

//获取字符串长度-GBK (PHP)
function

 gb_strlen(

$str

){

$count

 = 0;

for

(

$i

=0; 

$i

<

strlen

(

$str

); 

$i

 ){

$s

 = 

substr

(

$str

$i

, 1);

if

 (preg_match(“/[\x80-\xff]/”, 

$s

)) 

$i

;

$count

;

}

return

 

$count

;

}

 

 

//截取字符串字串-GBK (PHP)
function

 gb_substr(

$str

$len

){

$count

 = 0;