Chinese character intercepting functions supported by UTF-8 and GB2312

time:13-07-05 forum:PHP tools and code
  The Chinese character intercepting function
cut_str (string, intercept length, start length, encoding) is reloaded from http://www.jb51.net/article/4999.htm

[code].lt; php
/*
Utf-8 and GB2312;
the default is utf-8
the default = 0 $code ='UTF-8')
{
if ($code = ='UTF-8')
{
$pa =.quot; #91; \xf1-\xf7.#93;.#91; \x80-\xbf.#93;.#91; \x80-\xbf.#93;.#91; \x80-\xbf.#93; /.quot;
preg_match_all. CE ($t_string.#91; 0.#93; $start, $sublen));
}
else
{
$start = $start*2; ($i, 1)).Gt; 129)
{
$tmpstr.= substr ($string, $i, 2);
}
else
{echo cut_str ($str, 8, 0,'gb2312');
;.Gt; [/code]

prev:Three "night tour Ji'nan" packages offer... next:An introductory PHP Class article
post comment
Notice



approved   Massaging the acupoints can relieve ...   Baby swimming pool built in Britain   The survival record of women scienti...   The Russian 4 year old girl walked 3...   A new Ji'nan dialect study by 85 yea...
rand   PHP curl function to simulate crawle...   PHP curl function simulation browser...   PHP uses curl to simulate user landi...   MYSQL query optimization   PHP completely filters HTML, JS, CSS...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com