Home  >  Article  >  Backend Development  >  How to solve inconsistent string lengths in PHP

How to solve inconsistent string lengths in PHP

小云云
小云云Original
2018-01-03 09:55:011749browse

This article mainly shares with you an article to solve the problem of inconsistent PHP string length. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to take a look, I hope it can help everyone.

As shown below:

$paramStr = iconv("UTF-8", "GB2312//Ignore", $paramStr); 
$paramStr = iconv("GB2312", "UTF-8//Ignore", $paramStr);

These two sentences can solve it.

Related recommendations:

js Example of extracting the length of a certain () special string_javascript skills

php string A more efficient way to determine length

php How to calculate the length of a string

The above is the detailed content of How to solve inconsistent string lengths in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn