PHP ord Function

What is ord Function and how it is used in string?

Explanation

The ord function returns the ASCII value of a character in PHP.

Syntax:


ord(string)

The syntax returns the ASCII value of the first character of the string.

Example :


<?php
echo ord("HIOX")."<br/>";
echo ord("I")."<br/>";
?>
Result :

72
73

In the above example the ASCII values of the strings "HIOX" and "I" are returned.

PHP Topics


Ask Questions

Ask Question