PHP ord

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : ord() function

Description

The ord() function is used to get the ASCII value of the first character of a string.

Version

(PHP 4 and above)

Syntax

ord(string1)

Parameter

Name

Description

Required /
Optional

Type

string1

The input string.

Required

String

Return value

The ASCII value as an integer.

Value Type : Integer.

Pictorial Presentation

php-string-ord()

Example of php ord() function

  1. $str1='w3resource.com';  

  2. echo ord($str1);  

  3. ?>  

Output :

119