ord 返回字符的 ASCII 码值 php函数


ord

(PHP 4, PHP 5)

ord返回字符的 ASCII 码值

说明

int ord ( string $string )

返回字符串 string 第一个字符的 ASCII 码值。

该函数是 chr() 的互补函数。

参数

string

一个字符。

返回值

返回整型的 ASCII 码值。

范例

Example #1 ord() 范例

<?php
$str 
" ";
if (
ord($str) == 10) {
    echo 
"The first character of $str is a line feed. ";
}
?>

参见


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3