1. Chinese interception: mb_substr().
mb_substr(s t r , str,str,start,l e n g t h , length,length,encoding)
Example
echo mb_substr('This is really nice',0,3,'utf-8'); //Output this true
2. English interception: use the substr() function. If the intercepted string is multiple bytes, garbled characters will appear.
Under utf8 encoding, since one Chinese character occupies 3 bytes.
$str = 'hello'; echo substr($str,1,2);//output el
3. $str[0], treats strings as character sets, not applicable to Chinese.
$str = 'hello'; echo $str[0];//output h
The above is how to intercept PHP strings. I hope it will be helpful to everyone.