ord

(PHP 3, PHP 4, PHP 5)

ord -- 文字のASCII値を返す

説明

int ord ( string string )

stringの先頭文字のASCII値を返します。 この関数はchr()と逆の動作をします。

例 1. ord()の例

<?php
$str
= "\n";
if (
ord ($str) == 10) {
    echo
"\$str の先頭は改行文字です。\n";
}
?>

ASCIIテーブルをhttp://www.asciitable.comで参照可能です。

chr()も参照ください。