Table of Contents

Syntax

int ord(string $text)

(PHP 4, PHP 5)

$text The source string to read.
RETURNS The ASCII character code (as an integer) for the first character of $text.

What it Does

This function interprets the ASCII character code for the first character of the source string ($text) and returns this as an integer.

Example

// Get the ASCII Code for the letter 'A'
$code = ord('Awesome!');
echo 'ASCII Code: '.$code;