zoukankan      html  css  js  c++  java
  • strtr函数的用法

    http://php.net/manual/en/function.strtr.php

    <?php
    $trans = array("h" => "-", "hello" => "hi", "hi" => "hello");
    echo strtr("hi all, I said hello", $trans);
    ?>

    The above example will output:
    hello all, I said hi

    function q2b($mstring)
    {
    $mstring = @preg_replace('/([x80-xFF])([x80-xFF])/xe', '(ord(substr(1,0,1))==163&&(ord(substr(2,1,2))>=161||ord(substr(2,1,2))<=254)?chr(ord(2)-0x80):12)', $mstring);
    $mstring = @preg_replace('/xa3([xa1-xfe])/e', 'chr(ord(1)-0x80)', $mstring);

    $arr = array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4','5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', 'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E','F' => 'F', 'G' => 'G', 'H' => 'H', 'I' => 'I', 'J' => 'J', 'K' => 'K', 'L' => 'L', 'M' => 'M', 'N' => 'N', 'O' => 'O','P' => 'P', 'Q' => 'Q', 'R' => 'R', 'S' => 'S', 'T' => 'T','U' => 'U', 'V' => 'V', 'W' => 'W', 'X' => 'X', 'Y' => 'Y','Z' => 'Z', 'a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd','e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i','j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n','o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's', 't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x', 'y' => 'y', 'z' => 'z','(' => '(', ')' => ')', '〔' => '[', '〕' => ']', '【' => '[','】' => ']', '〖' => '[', '〗' => ']', '“' => '[', '”' => ']','‘' => '[', "'" => ']', '{' => '{', '}' => '}', '《' => '<','》' => '>','%' => '%', '+' => '+', '—' => '-', '-' => '-', '~' => '-',':' => ':', '。' => '.', '、' => ',', ',' => '.', '、' => '.', ';' => ',', '?' => '?', '!' => '!', '…' => '-', '‖' => '|', '”' => '"', "'" => '`', '‘' => '`', '|' => '|', '〃' => '"',' ' => ' ');


    $mstring = strtr($mstring, $arrstrtr);

    return $mstring;
    }  

  • 相关阅读:
    解决“已禁用对分布式事务管理器(MSDTC)的网络访问”错误
    C# Freely convert between IList<T> and IEnumerable<T>
    Json MaxJsonLength Error
    [转]Introducing the IE8 Developer Tools JScript Profiler
    页面调试心得
    ASP.NET中Label控件特殊之处
    模板模式
    Android中通过typeface设置字体
    Android 新浪微博授权
    【转】android:网络图片转为bitmap 保存至SD卡中
  • 原文地址:https://www.cnblogs.com/wangkongming/p/4011359.html
Copyright © 2011-2022 走看看