奶头挺立呻吟高潮av全片,成人试看120秒体验区,性欧美极品v,A片高潮抽搐揉捏奶头视频

php語言

php實現utf-8轉unicode函數分享

時間:2024-09-17 00:32:33 php語言 我要投稿
  • 相關推薦

php實現utf-8轉unicode函數分享

  php實現utf-8轉unicode函數如何操作呢?需要的朋友可以參考下,代碼很簡單,功能卻很實用,推薦給大家。希望對大家有所幫助!

  奉上代碼先:

  復制代碼 代碼如下:

  public function utf8_unicode($str) {

  $unicode = array();

  $values = array();

  $lookingFor = 1;

  for ($i = 0; $i < strlen( $str ); $i++ ) {

  $thisValue = ord( $str[ $i ] );

  if ( $thisValue < ord('A') ) {

  // exclude 0-9

  if ($thisValue >= ord('0') && $thisValue <= ord('9')) {

  // number

  $unicode[] = chr($thisValue);

  }

  else {

  $unicode[] = '%'.dechex($thisValue);

  }

  } else {

  if ( $thisValue < 128) {

  $unicode[] = $str[ $i ];

  } else {

  if ( count( $values ) == 0 ) {

  $lookingFor = ( $thisValue < 224 ) ? 2 : 3;

  }

  $values[] = $thisValue;

  if ( count( $values ) == $lookingFor ) {

  $number = ( $lookingFor == 3 ) ?

  ( ( $values[0] % 16 ) * 4096 ) + ( ( $values[1] % 64 ) * 64 ) + ( $values[2] % 64 ):

  ( ( $values[0] % 32 ) * 64 ) + ( $values[1] % 64 );

  $number = dechex($number);

  $unicode[] = (strlen($number)==3)?"\u0".$number:"\u".$number;

  $values = array();

  $lookingFor = 1;

  } // if

  } // if

  }

  } // for

  return implode("",$unicode);

  }

【php實現utf-8轉unicode函數分享】相關文章:

PHP與UTF-8的最佳實踐12-04

PHP與UTF-8 的最佳實踐介紹11-16

PHP函數知識總結11-28

PHP數組函數知識11-29

PHP類與構造函數12-11

PHP函數的區別及用法11-28

php摘要生成函數詳解03-02

簡單PHP數組函數介紹11-28

PHP網絡操作函數講解12-02

主站蜘蛛池模板: 新闻| 宁晋县| 虎林市| 凤翔县| 南城县| 习水县| 临潭县| 石台县| 寿宁县| 伊金霍洛旗| 施秉县| 永宁县| 伊吾县| 新疆| 汾西县| 罗源县| 定南县| 平原县| 洛阳市| 潜山县| 武邑县| 克拉玛依市| 镇宁| 共和县| 临沧市| 广州市| 柘城县| 温州市| 台安县| 东乡| 南丹县| 济阳县| 通化市| 阿合奇县| 华宁县| 随州市| 金山区| 宁乡县| 东阳市| 黑水县| 泰顺县|