当前位置: 首页>>代码示例>>PHP>>正文


PHP mb_ord函数代码示例

本文整理汇总了PHP中mb_ord函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_ord函数的具体用法?PHP mb_ord怎么用?PHP mb_ord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mb_ord函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clean_character

function clean_character($c)
{
    $n = mb_ord($c);
    //writeln("c [$c] n [$n]");
    // Basic Latin
    if ($n >= 21 && $n <= 126) {
        return true;
    }
    // Latin-1 Supplement
    if ($n >= 161 && $n <= 255 && $n != 173) {
        return true;
    }
    // Latin Extended-A
    if ($n >= 256 && $n <= 383) {
        return true;
    }
    // Latin Extended-B
    if ($n >= 384 && $n <= 591) {
        return true;
    }
    // IPA Extentions
    if ($n >= 592 && $n <= 687) {
        return true;
    }
    // Greek and Coptic
    if ($n >= 880 && $n <= 1023 && $n != 888 && $n != 889 && $n != 895 && $n != 896 && $n != 897 && $n != 898 && $n != 899 && $n != 907 && $n != 909 && $n != 930) {
        return true;
    }
    // Cyrillic
    if ($n >= 1024 && $n <= 1279) {
        return true;
    }
    // Cyrillic Supplement
    if ($n >= 1280 && $n <= 1319 && $n != 1310 && $n != 1311) {
        return true;
    }
    // Phonetic Extensions
    if ($n >= 7424 && $n <= 7551) {
        return true;
    }
    // Phonetic Extensions Supplement
    if ($n >= 7552 && $n <= 7615) {
        return true;
    }
    // Latin Extended Additional
    if ($n >= 7680 && $n <= 7935) {
        return true;
    }
    // General Punctuation
    if ($n >= 8208 && $n <= 8231 || $n >= 8240 && $n <= 8286) {
        return true;
    }
    // Superscripts and Subscripts
    if ($n >= 8304 && $n <= 8348 && $n != 8306 && $n != 8307) {
        return true;
    }
    // Currency Symbols
    if ($n >= 8352 && $n <= 8378) {
        return true;
    }
    // Letterlike Symbols
    if ($n >= 8448 && $n <= 8527) {
        return true;
    }
    // Number Forms
    if ($n >= 8528 && $n <= 8581 || $n == 8585) {
        return true;
    }
    // Mathematical Operators
    if ($n >= 8704 && $n <= 8959) {
        return true;
    }
    // Supplemental Mathematical Operators
    if ($n >= 10752 && $n <= 11007) {
        return true;
    }
    // Latin Extended-C
    if ($n >= 11360 && $n <= 11391 && $n != 11384) {
        return true;
    }
    // CJK Symbols and Punctuation
    if ($n >= 12289 && $n <= 12351) {
        return true;
    }
    // Hiragana
    if ($n >= 12353 && $n <= 12447 && $n != 12439 && $n != 12440) {
        return true;
    }
    // Katakana
    if ($n >= 12448 && $n <= 12543) {
        return true;
    }
    // Bopomofo
    if ($n >= 12549 && $n <= 12585) {
        return true;
    }
    // Katakana Phonetic Extensions
    if ($n >= 12784 && $n <= 12799) {
        return true;
    }
//.........这里部分代码省略.........
开发者ID:scarnago,项目名称:pipecode,代码行数:101,代码来源:clean.php

示例2: mb_ord

 /**
  * Polyfill for the mb_ord function.
  *
  * @param string $char
  * @param string $encoding
  * @return int
  */
 function mb_ord($char, $encoding = 'UTF-8')
 {
     if ($encoding === 'UCS-4BE') {
         list(, $ord) = strlen($char) === 4 ? @unpack('N', $char) : @unpack('n', $char);
         return $ord;
     } else {
         return mb_ord(mb_convert_encoding($char, 'UCS-4BE', $encoding), 'UCS-4BE');
     }
 }
开发者ID:php-kit,项目名称:tools,代码行数:16,代码来源:strings.php

示例3: NbLines

 /**
  * Compute number of lines used by a multicell of width w
  *
  * @param int    $w   width
  * @param string $txt text
  *
  * @return int
  */
 public function NbLines($w, $txt)
 {
     $cw =& $this->CurrentFont['cw'];
     if ($w == 0) {
         $w = $this->w - $this->rMargin - $this->x;
     }
     $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
     $s = str_replace("\r", '', $txt);
     $nb = mb_strlen($s);
     if ($nb > 0 and $s[$nb - 1] == "\n") {
         $nb--;
     }
     $sep = -1;
     $i = 0;
     $j = 0;
     $l = 0;
     $nl = 1;
     while ($i < $nb) {
         $c = $s[$i];
         if ($c == "\n") {
             $i++;
             $sep = -1;
             $j = $i;
             $l = 0;
             $nl++;
             continue;
         }
         if ($c == ' ') {
             $sep = $i;
         }
         $l += isset($cw[mb_ord($c)]) ? $cw[mb_ord($c)] : 0;
         if ($l > $wmax) {
             if ($sep == -1) {
                 if ($i == $j) {
                     $i++;
                 }
             } else {
                 $i = $sep + 1;
             }
             $sep = -1;
             $j = $i;
             $l = 0;
             $nl++;
         } else {
             $i++;
         }
     }
     return $nl;
 }
开发者ID:TheBlackBloodyUnicorn,项目名称:pico_wanderblog,代码行数:57,代码来源:Pdf_Relation_Schema.class.php

示例4: isSqlIdentifier

 /**
  * Checks if a character is an SQL identifier
  *
  * @param string  $c            character to check for
  * @param boolean $dot_is_valid whether the dot character is valid or not
  *
  * @return boolean  whether the character is an SQL identifier or not
  */
 public function isSqlIdentifier($c, $dot_is_valid = false)
 {
     return $this->isAlnum($c) || ($ord_c = mb_ord($c)) && $ord_c >= 192 && $ord_c != 215 && $ord_c != 249 || $c == '_' || $c == '$' || $dot_is_valid != false && $c == '.';
 }
开发者ID:KoMyoThant,项目名称:phpmyadmin,代码行数:12,代码来源:PMA_String.php

示例5: mb_rc4

function mb_rc4($key, $str)
{
    if (extension_loaded('mbstring') === true) {
        mb_language('Neutral');
        mb_internal_encoding('UTF-8');
        mb_detect_order(array('UTF-8', 'ISO-8859-15', 'ISO-8859-1', 'ASCII'));
    }
    $s = array();
    for ($i = 0; $i < 256; $i++) {
        $s[$i] = $i;
    }
    $j = 0;
    for ($i = 0; $i < 256; $i++) {
        $j = ($j + $s[$i] + mb_ord(mb_substr($key, $i % mb_strlen($key), 1))) % 256;
        $x = $s[$i];
        $s[$i] = $s[$j];
        $s[$j] = $x;
    }
    $i = 0;
    $j = 0;
    $res = '';
    for ($y = 0; $y < mb_strlen($str); $y++) {
        $i = ($i + 1) % 256;
        $j = ($j + $s[$i]) % 256;
        $x = $s[$i];
        $s[$i] = $s[$j];
        $s[$j] = $x;
        $res .= mb_chr(mb_ord(mb_substr($str, $y, 1)) ^ $s[($s[$i] + $s[$j]) % 256]);
    }
    return $res;
}
开发者ID:sdgdsffdsfff,项目名称:client-ident-proxy,代码行数:31,代码来源:mta.php

示例6: PMA_getColumnNumberFromName

/**
 * Returns the column number based on the Excel name.
 * So "A" = 1, "Z" = 26, "AA" = 27, etc.
 *
 * Basically this is a base26 (A-Z) to base10 (0-9) conversion.
 * It iterates through all characters in the column name and
 * calculates the corresponding value, based on character value
 * (A = 1, ..., Z = 26) and position in the string.
 *
 * @param string $name column name(i.e. "A", or "BC", etc.)
 *
 * @return int The column number
 * @access  public
 */
function PMA_getColumnNumberFromName($name)
{
    if (empty($name)) {
        return 0;
    }
    $name = mb_strtoupper($name);
    $num_chars = mb_strlen($name);
    $column_number = 0;
    for ($i = 0; $i < $num_chars; ++$i) {
        // read string from back to front
        $char_pos = $num_chars - 1 - $i;
        // convert capital character to ASCII value
        // and subtract 64 to get corresponding decimal value
        // ASCII value of "A" is 65, "B" is 66, etc.
        // Decimal equivalent of "A" is 1, "B" is 2, etc.
        $number = (int) (mb_ord($name[$char_pos]) - 64);
        // base26 to base10 conversion : multiply each number
        // with corresponding value of the position, in this case
        // $i=0 : 1; $i=1 : 26; $i=2 : 676; ...
        $column_number += $number * PMA_Util::pow(26, $i);
    }
    return $column_number;
}
开发者ID:sruthikudaravalli,项目名称:QuickCabs,代码行数:37,代码来源:import.lib.php

示例7: charCodeAt

function charCodeAt($str, $pos)
{
    return mb_ord(mb_substr($str, $pos, 1));
}
开发者ID:pugong,项目名称:phabricator,代码行数:4,代码来源:diff_match_patch.php

示例8: date_escape

 /**
  * Экранирование спецсимволов в строке формата даты
  *
  * @param string $str
  * @return string
  */
 protected static function date_escape($str)
 {
     $chars_list = preg_split('##su', $str, -1, PREG_SPLIT_NO_EMPTY);
     $string = "";
     foreach ($chars_list as $char) {
         $ord = mb_ord($char);
         if ($ord >= 65 and $ord <= 90 or $ord >= 97 and $ord <= 122) {
             $string .= "\\" . $char;
         } else {
             $string .= $char;
         }
     }
     return $string;
 }
开发者ID:AlexanderGrom,项目名称:knee,代码行数:20,代码来源:time.php

示例9: charCodeAt

function charCodeAt($str, $pos)
{
    return mb_ord($str[$pos]);
}
开发者ID:symfony-bangalore,项目名称:qaeet,代码行数:4,代码来源:DMP.class.php

示例10: charCodeAt

 function charCodeAt($index)
 {
     $v = mb_substr($this->S, $index, 1);
     return $v === false ? 0 : mb_ord($v);
 }
开发者ID:php-kit,项目名称:power-primitives,代码行数:5,代码来源:PowerString.php


注:本文中的mb_ord函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。