• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ord函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: mb_ord

function mb_ord($char)
{
    $k = mb_convert_encoding($char, 'UCS-2LE', 'UTF-8');
    $k1 = ord(substr($k, 0, 1));
    $k2 = ord(substr($k, 1, 1));
    return $k2 * 256 + $k1;
}
开发者ID:Cazzar,项目名称:Shocky,代码行数:7,代码来源:shocky.php


示例2: containsNonValidUTF8

 /**
  * Tells whether or not string contains non valid UTF-8 byte ...
  * @static
  * @author javalc6 at gmail dot com (modified)
  * @see http://www.php.net/manual/en/function.mb-check-encoding.php#95289
  * @param string $str
  * @return bool
  */
 public static function containsNonValidUTF8($str)
 {
     if (preg_replace("[a-zA-Z0-9\\S]", '', $str) == '') {
         return false;
     }
     $len = strlen($str);
     for ($i = 0; $i < $len; $i++) {
         $c = ord($str[$i]);
         if ($c > 128) {
             if ($c > 247) {
                 return true;
             } elseif ($c > 239) {
                 $bytes = 4;
             } elseif ($c > 223) {
                 $bytes = 3;
             } elseif ($c > 191) {
                 $bytes = 2;
             } else {
                 return true;
             }
             if ($i + $bytes > $len) {
                 return true;
             }
             while ($bytes > 1) {
                 $i++;
                 $b = ord($str[$i]);
                 if ($b < 128 || $b > 191) {
                     return true;
                 }
                 $bytes--;
             }
         }
     }
     return false;
 }
开发者ID:NavalKishor,项目名称:PHP-Rocker,代码行数:43,代码来源:Utils.php


示例3: generate

 /**
  * @param $file_name
  * @return array
  * @throws ApplicationException
  */
 public static function generate($file_name)
 {
     set_time_limit(0);
     $temp_file = TempFileProvider::generate("peaks", ".raw");
     $command = sprintf("%s -v quiet -i %s -ac 1 -f u8 -ar 11025 -acodec pcm_u8 %s", self::$ffmpeg_cmd, escapeshellarg($file_name), escapeshellarg($temp_file));
     shell_exec($command);
     if (!file_exists($temp_file)) {
         throw new ApplicationException("Waveform could not be generated!");
     }
     $chunk_size = ceil(filesize($temp_file) / self::PEAKS_RESOLUTION);
     $peaks = withOpenedFile($temp_file, "r", function ($fh) use(&$chunk_size) {
         while ($data = fread($fh, $chunk_size)) {
             $peak = 0;
             $array = str_split($data);
             foreach ($array as $item) {
                 $code = ord($item);
                 if ($code > $peak) {
                     $peak = $code;
                 }
                 if ($code == 255) {
                     break;
                 }
             }
             (yield $peak - 127);
         }
     });
     TempFileProvider::delete($temp_file);
     return $peaks;
 }
开发者ID:pldin601,项目名称:HomeMusic,代码行数:34,代码来源:WaveformGenerator.php


示例4: ftok

 function ftok($pathname, $id)
 {
     if (!($s = stat($pathname))) {
         return -1;
     }
     return sprintf('%u', ord($id[0]) << 24 | ($s['dev'] & 0xff) << 16 | $s['ino'] & 0xffff);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:7,代码来源:synchronized.sapi.php


示例5: show

function show($headeri)
{
    $ii = 0;
    $ji = 0;
    $ki = 0;
    $ci = 0;
    echo '<table border="0"><tr>';
    while ($ii <= strlen($headeri) - 1) {
        $datai = dechex(ord($headeri[$ii]));
        if ($ji == 16) {
            $ji = 0;
            $ci++;
            echo "<td>&nbsp;&nbsp;</td>";
            for ($li = 0; $li <= 15; $li++) {
                echo "<td>" . $headeri[$li + $ki] . "</td>";
            }
            $ki = $ki + 16;
            echo "</tr><tr>";
        }
        if (strlen($datai) == 1) {
            echo "<td>0" . $datai . "</td>";
        } else {
            echo "<td>" . $datai . "</td> ";
        }
        $ii++;
        $ji++;
    }
    for ($li = 1; $li <= 16 - strlen($headeri) % 16 + 1; $li++) {
        echo "<td>&nbsp&nbsp</td>";
    }
    for ($li = $ci * 16; $li <= strlen($headeri); $li++) {
        echo "<td>" . $headeri[$li] . "</td>";
    }
    echo "</tr></table>";
}
开发者ID:SuperQcheng,项目名称:exploit-database,代码行数:35,代码来源:1324.php


示例6: makeHex

function makeHex($st)
{
    for ($i = 0; $i < strlen($st); $i++) {
        $hex[] = sprintf("%02X", ord($st[$i]));
    }
    return join(" ", $hex);
}
开发者ID:igorsimdyanov,项目名称:php7,代码行数:7,代码来源:textbin.php


示例7: scrambleEmail

function scrambleEmail($email, $method='unicode')
{
	switch ($method) {
	case 'strtr':
		$trans = array(	"@" => tra("(AT)"),
						"." => tra("(DOT)")
		);
		return strtr($email, $trans);
	case 'x' :
		$encoded = $email;
		for ($i = strpos($email, "@") + 1, $istrlen_email = strlen($email); $i < $istrlen_email; $i++) {
			if ($encoded[$i]  != ".") $encoded[$i] = 'x';
		}
		return $encoded;
	case 'unicode':
	case 'y':// for previous compatibility
		$encoded = '';
		for ($i = 0, $istrlen_email = strlen($email); $i < $istrlen_email; $i++) {
			$encoded .= '&#' . ord($email[$i]). ';';
		}
		return $encoded;
	case 'n':
	default:
		return $email;
	}
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:26,代码来源:scrambleEmail.php


示例8: cuerpoPagina

 private function cuerpoPagina()
 {
     $this->seccionesDeclaradas = array(0, 0, 0, 0, 0);
     foreach ($this->bloques as $unBloque) {
         $posicion = ord($unBloque[self::SECCION]) - 65;
         $this->seccionesDeclaradas[$posicion] = $unBloque[self::SECCION];
     }
     echo "<body>\n";
     echo "<div id='marcoGeneral'>\n";
     if (in_array("A", $this->seccionesDeclaradas, true)) {
         $this->armarSeccionAmplia("A");
     }
     if (in_array("B", $this->seccionesDeclaradas, true)) {
         $this->armarSeccionLateral("B");
     }
     if (in_array("C", $this->seccionesDeclaradas, true)) {
         $this->armarSeccionCentral();
     }
     if (in_array("D", $this->seccionesDeclaradas, true)) {
         $this->armarSeccionLateral("D");
     }
     if (in_array("E", $this->seccionesDeclaradas, true)) {
         $this->armarSeccionAmplia("E");
     }
     echo "</div>\n";
     $this->piePagina();
     echo "</body>\n";
 }
开发者ID:violetasdev,项目名称:polux,代码行数:28,代码来源:ArmadorPagina.class.php


示例9: escape

 /**
  * Escape strings for safe use in an LDAP filter or DN
  *
  * @see RFC2254 define how string search filters must be represented
  * @see For PHP >= 5.6.0, ldap_escape() is a core function
  *
  * @author Chris Wright
  * @see https://github.com/DaveRandom/LDAPi/blob/master/src/global_functions.php
  *
  * @return String
  */
 private function escape($value, $ignore = '', $flags = 0)
 {
     if (function_exists('ldap_escape')) {
         return ldap_escape($value, $ignore, $flags);
     }
     $value = (string) $value;
     $ignore = (string) $ignore;
     $flags = (int) $flags;
     if ($value === '') {
         return '';
     }
     $char_list = array();
     if ($flags & self::LDAP_ESCAPE_FILTER) {
         $char_list = array("\\", "*", "(", ")", "");
     }
     if ($flags & self::LDAP_ESCAPE_DN) {
         $char_list = array_merge($char_list, array("\\", ",", "=", "+", "<", ">", ";", "\"", "#"));
     }
     if (!$char_list) {
         for ($i = 0; $i < 256; $i++) {
             $char_list[] = chr($i);
         }
     }
     $char_list = array_flip($char_list);
     for ($i = 0; isset($ignore[$i]); $i++) {
         unset($char_list[$ignore[$i]]);
     }
     foreach ($char_list as $k => &$v) {
         $v = sprintf('\\%02x', ord($k));
     }
     return strtr($value, $char_list);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:43,代码来源:QueryEscaper.class.php


示例10: decode

 public static function decode($input)
 {
     if (empty($input)) {
         return;
     }
     $paddingCharCount = substr_count($input, self::$map[32]);
     $allowedValues = array(6, 4, 3, 1, 0);
     if (!in_array($paddingCharCount, $allowedValues)) {
         return false;
     }
     for ($i = 0; $i < 4; $i++) {
         if ($paddingCharCount == $allowedValues[$i] && substr($input, -$allowedValues[$i]) != str_repeat(self::$map[32], $allowedValues[$i])) {
             return false;
         }
     }
     $input = str_replace('=', '', $input);
     $input = str_split($input);
     $binaryString = "";
     for ($i = 0; $i < count($input); $i = $i + 8) {
         $x = "";
         if (!in_array($input[$i], self::$map)) {
             return false;
         }
         for ($j = 0; $j < 8; $j++) {
             $x .= str_pad(base_convert(@self::$flippedMap[@$input[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
         }
         $eightBits = str_split($x, 8);
         for ($z = 0; $z < count($eightBits); $z++) {
             $binaryString .= ($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48 ? $y : "";
         }
     }
     return $binaryString;
 }
开发者ID:kraczo,项目名称:pracowniapizzy,代码行数:33,代码来源:base32.php


示例11: index

 public function index()
 {
     $filename = "s.pdf";
     $content = shell_exec('pdftotext -raw ' . $filename . ' -');
     $separator = "\r\n";
     $line = strtok($content, $separator);
     $i = 0;
     $j = 0;
     while ($line !== false) {
         $i++;
         if ($line == 'Issue') {
             $j++;
             $data = new stdClass();
             $data->muhasil = strtok($separator);
             $data->jumlah = strtok($separator);
             $data->no_m1 = strtok($separator);
             $data->periode = strtok($separator);
             $data->nama = strtok($separator);
             $data->aims = strtok($separator);
             list($data->tanggal, $data->metode) = explode(' ', strtok($separator));
             while (($line = strtok($separator)) != 'Issue' && ord($line[0]) != 12) {
                 $data->rincian[] = $line;
             }
             var_dump($data);
             echo '<br/>------------------------------------<br/>';
         } else {
             $line = strtok($separator);
         }
     }
 }
开发者ID:isandroid,项目名称:gerbang-sms,代码行数:30,代码来源:pdf_rincian_candah.php


示例12: getValueFromChar

 private function getValueFromChar($ch)
 {
     $val = ord($ch);
     try {
         if ($this->type == 'A') {
             if ($val > 95) {
                 throw new Exception(' illegal barcode character ' . $ch . ' for code128A in ' . __FILE__ . ' on line ' . __LINE__);
             }
             if ($val < 32) {
                 $val += 64;
             } else {
                 $val -= 32;
             }
         } elseif ($this->type == 'B') {
             if ($val < 32 || $val > 127) {
                 throw new Exception(' illegal barcode character ' . $ch . ' for code128B in ' . __FILE__ . ' on line ' . __LINE__);
             } else {
                 $val -= 32;
             }
         } else {
             if (!is_numeric($ch) || (int) $ch < 0 || (int) $ch > 99) {
                 throw new Exception(' illegal barcode character ' . $ch . ' for code128C in ' . __FILE__ . ' on line ' . __LINE__);
             } else {
                 if (strlen($ch) == 1) {
                     $ch .= '0';
                 }
                 $val = (int) $ch;
             }
         }
     } catch (Exception $ex) {
         errorlog('die', $ex->getMessage());
     }
     return $val;
 }
开发者ID:554119220,项目名称:kjrscrm,代码行数:34,代码来源:cls_code.php


示例13: decrypt

function decrypt($key, $password)
{
    $result = "";
    for ($i = 0; $i < strlen($password); $i++) {
        //var c = password.charCodeAt(i);
        $c = ord($password[$i]);
        if ($c >= 33 && $c <= 64) {
            //number or symbol (33 to 64)
            $result = $result . chr((($c - 33 - $key) % 32 + 32) % 32 + 33);
        } else {
            if ($c >= 65 && $c <= 90) {
                //upper case letter
                $result = $result . chr((($c - 65 - $key) % 26 + 26) % 26 + 65);
            } else {
                if ($c >= 97 && $c <= 122) {
                    //lower case letter
                    $result = $result . chr((($c - 97 - $key) % 26 + 26) % 26 + 97);
                } else {
                    //not a letter, we leave it like that
                    $result = $result . chr($c);
                }
            }
        }
    }
    return $result;
}
开发者ID:Dzinator,项目名称:WebLogin,代码行数:26,代码来源:login.php


示例14: cnsubstr

 public static function cnsubstr($s, $len = 0)
 {
     $n = strlen($s);
     $r = '';
     $rlen = 0;
     // 32, 64
     $UTF8_1 = 0x80;
     $UTF8_2 = 0x40;
     $UTF8_3 = 0x20;
     for ($i = 0; $i < $n; $i++) {
         $c = '';
         $ord = ord($s[$i]);
         if ($ord < 127) {
             $rlen++;
             $r .= $s[$i];
         } elseif ($ord & $UTF8_1 && $ord & $UTF8_2 && $ord & $UTF8_3) {
             // 期望后面的字符满足条件,否则抛弃	  && ord($s[$i+1]) & $UTF8_2
             if ($i + 1 < $n && ord($s[$i + 1]) & $UTF8_1) {
                 if ($i + 2 < $n && ord($s[$i + 2]) & $UTF8_1) {
                     $rlen += 2;
                     $r .= $s[$i] . $s[$i + 1] . $s[$i + 2];
                 } else {
                     $i += 2;
                 }
             } else {
                 $i++;
             }
         }
         if ($rlen >= $len) {
             break;
         }
     }
     return $r;
 }
开发者ID:ArronYR,项目名称:collect,代码行数:34,代码来源:utf8.class.php


示例15: valid2

 private static function valid2($str)
 {
     // From www.php.net/manual/en/function.mb-check-encoding.php
     $len = strlen($str);
     for ($i = 0; $i < $len; $i++) {
         $c = ord($str[$i]);
         if ($c > 128) {
             if ($c > 247) {
                 return false;
             } elseif ($c > 239) {
                 $bytes = 4;
             } elseif ($c > 223) {
                 $bytes = 3;
             } elseif ($c > 191) {
                 $bytes = 2;
             } else {
                 return false;
             }
             if ($i + $bytes > $len) {
                 return false;
             }
             while ($bytes > 1) {
                 $i++;
                 $b = ord($str[$i]);
                 if ($b < 128 || $b > 191) {
                     return false;
                 }
                 $bytes--;
             }
         }
     }
     return true;
 }
开发者ID:alerque,项目名称:bibledit,代码行数:33,代码来源:utf8.php


示例16: assign

 public final function assign($key, $value = '')
 {
     if (true == is_null($this->__tpl_vars)) {
         $this->__tpl_vars = array();
     }
     if (is_string($key)) {
         $key = trim($key, ' ');
         $firstCode = '' == $key ? 0 : ord($key[0]);
         if ($firstCode < 65 && $firstCode > 122 || $firstCode > 90 && $firstCode < 97) {
             return false;
         } else {
             $this->__tpl_vars[$key] = $value;
             return true;
         }
     } else {
         if (is_array($key)) {
             $isThrowError = false;
             foreach ($key as $k => $v) {
                 $firstCode = ord($key[0]);
                 if ($firstCode < 65 && $firstCode > 122 || $firstCode > 90 && $firstCode < 97) {
                     $isThrowError = true;
                     break;
                 }
             }
             if (true == $isThrowError) {
                 return false;
             } else {
                 $this->__tpl_vars = array_merge($this->__tpl_vars, $key);
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:asmenglei,项目名称:lanxiao,代码行数:34,代码来源:MY_Controller.php


示例17: hash_equals

 function hash_equals($known_str, $user_str)
 {
     if (!is_string($known_str)) {
         trigger_error("Expected known_str to be a string, {$known_str} given", E_USER_WARNING);
         return false;
     }
     if (!is_string($user_str)) {
         trigger_error("Expected user_str to be a string, {$user_str} given", E_USER_WARNING);
         return false;
     }
     $known_len = strlen($known_str);
     $user_len = strlen($user_str);
     if ($known_len != $user_len) {
         // if different lengths, do comparison as well, to have time constant
         // but return false as expected
         $user_str = $known_str;
         $result = 1;
     } else {
         $result = 0;
     }
     /* This is security sensitive code. Do not optimize this for speed. */
     for ($j = 0; $j < $known_len; $j++) {
         $result |= ord($known_str[$j] ^ $user_str[$j]);
     }
     return $result == 0;
 }
开发者ID:medali1990,项目名称:medsite,代码行数:26,代码来源:hash_equals.php


示例18: enjumble

function enjumble($data)
{
    for ($i = 0; $i < strlen($data); $i++) {
        $data[$i] = chr(ord($data[$i]) + 1);
    }
    return base64_encode(gzdeflate($data, 9));
}
开发者ID:xl7dev,项目名称:WebShell,代码行数:7,代码来源:Carbylamine+PHP+Encoder.php


示例19: btwoc

 /**
  * Get the big endian two's complement of a given big integer in
  * binary notation
  *
  * @param string $long
  * @return string
  */
 public function btwoc($long)
 {
     if (ord($long[0]) > 127) {
         return "" . $long;
     }
     return $long;
 }
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:14,代码来源:Math.php


示例20: do_login

 function do_login($username, $password, $jenis_kantor, $tgl, $dt, $nama_kantor)
 {
     $username = strtoupper($username);
     $password = strtoupper($password);
     $nama_lkm = $nama_kantor;
     $tgl = $tgl;
     $dt = $dt;
     // cek di database, ada ga?
     $this->CI->db->from('nasabah');
     $this->CI->db->where('nasabah_id', $username);
     $result = $this->CI->db->get();
     if ($result->num_rows() == 1) {
         $hasil = $result->result();
         foreach ($hasil as $row) {
             $arr = array('usr' => $row->nasabah_id, 'namaNasabah' => $row->nama_nasabah, 'pwd' => $row->password);
         }
         $m = '';
         $split_password = str_split($arr['pwd']);
         foreach ($split_password as $value) {
             $x = ord($value);
             $x = $x - 5;
             $x = chr($x);
             $m = $m . $x;
         }
         //$m = passowor dr sql
         if ($password == $m) {
             if ($m == '111111') {
                 $this->CI->load->helper('cookie');
                 $cookie1 = array('name' => 'userId', 'value' => $arr['usr'], 'expire' => time() + 86500);
                 set_cookie($cookie1);
                 $cookie2 = array('name' => 'namaUser', 'value' => $arr['namaNasabah'], 'expire' => time() + 86500);
                 set_cookie($cookie1);
                 $cookie3 = array('name' => 'namaLKM', 'value' => $nama_lkm, 'expire' => time() + 86500);
                 $cookie4 = array('name' => 'tglD', 'value' => $tgl, 'expire' => time() + 86500);
                 $cookie5 = array('name' => 'tglY', 'value' => $dt, 'expire' => time() + 86500);
                 set_cookie($cookie1);
                 set_cookie($cookie2);
                 set_cookie($cookie3);
                 set_cookie($cookie4);
                 set_cookie($cookie5);
                 redirect('main/vResetPassword');
             } else {
                 // end if $m=='111111'
                 $session_data = array('user_id' => $arr['usr'], 'nama' => $arr['namaNasabah'], 'level' => 2, 'tglD' => $tgl, 'tglY' => $dt, 'nama_lkm' => $nama_lkm);
                 // buat session
                 $this->CI->session->set_userdata($session_data);
                 $data_auth = array('pesan' => "Anda berhasil login.", 'bool' => true);
                 return $data_auth;
             }
         } else {
             //if($password==$m){
             $data_auth = array('pesan' => "Password anda salah.", 'bool' => false);
             return $data_auth;
             //  die("Maaf, Anda tidak berhak untuk mengakses halaman ini.");
         }
     } else {
         //end if($result->num_rows() == 1){
         return false;
     }
 }
开发者ID:anggasap,项目名称:saribhakti,代码行数:60,代码来源:auth.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP order函数代码示例发布时间:2022-05-15
下一篇:
PHP ora_rollback函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap