Looking to get a head start on your next software interview? Pickup a copy of the best book to prepare: Cracking The Coding Interview!
The `mb_ord()` function returns the Unicode code point value of a specified character. It is similar to the `ord()` function in PHP, but it supports multi-byte characters.
Here’s an example of how to use `mb_ord()` to get the Unicode value of a character at a specific index in a string:
$string = "Hello, world!";
$index = 1;
$unicodeValue = mb_ord($string[$index], 'UTF-8');
echo $unicodeValue; // Output: 101
In this example, we’re getting the Unicode value of the character at index 1 in the string “Hello, world!”. The `mb_ord()` function takes two parameters: the character to get the Unicode value of, and the character encoding of the string (in this case, UTF-8).