w3resource

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

<?php
$str1='w3resource.com';
echo ord($str1);
?>

Output:

119

View the example in the browser

See also

PHP Function Reference

Previous: number_format
Next: parse_str



PHP: Tips of the Day

PHP: Where is PHP.ini in Mac OS X Lion? Thought it was in /usr/local/php5/lib

You should find it in /private/etc if it exists, otherwise:

sudo cp /private/etc/php.ini.default /private/etc/php.ini

Ref : https://bit.ly/3nYzEyI