Home > Backend Development > PHP Tutorial > PHP function: a simple way to determine character encoding_PHP tutorial

PHP function: a simple way to determine character encoding_PHP tutorial

WBOY
Release: 2016-07-13 17:40:55
Original
1076 people have browsed it

  1. function chkbm($string){
  2. $bm = array(ASCII, GBK, UTF-8 );
  3. foreach($bm as $c){
  4. if( $string === iconv(UTF-8, $c, iconv($c, UTF-8, $string))){//Is it equal after conversion? ;
  5. }
  6. ?>
  7. http://www.bkjia.com/PHPjc/486172.html
www.bkjia.com
true

http: //www.bkjia.com/PHPjc/486172.html

?php function chkbm($string){ $bm = array(ASCII, GBK, UTF-8); foreach ($bm as $c){ if( $string === iconv(UTF-8, $c, iconv($c, UTF-8, $string))){//Is the encoding equal after conversion retu.. .
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template