PHP tips [to] PHP tips seem to be. most of the time, we use strtolower or strtoupper to compare strings, and then judge whether they are equal. In this case, the conversion is required twice. Most of the time, we are for character set conversion will be like this, such as determining whether the parameter passed in UTF-8, the five character writing, but more, such as UTF-8, Utf-8, what should we do with UTF-8? Strt PHP tips [go]
Tips for PHP
It seems that most of the time, we use strtolower or strtoupper to compare strings, and then judge whether they are equal. In this case, the conversion is required twice. Most of the time, we are for character set conversion will be like this, such as determining whether the parameter passed in UTF-8, the five character writing, but more, such as UTF-8, Utf-8, what should we do with UTF-8? Strtolower? Strupper? No ..
Strncasecmp ($ a, $ B, $ length ..
If the return value is 0, it is equal. how can we determine?
Strncasecmp ($ str, 'utf-8', 5) = 0. then, the input parameter is utf8. is it convenient?
These functions are not commonly used. I can see that the function is used in yii framework. when processing events and determining whether the first two characters are on, this is the case. I also learned a trick.
Http://www.neatstudio.com/show-1477-1.shtml