Mahdi Khezrabadi
Mahdi Khezrabadi

Reputation: 65

How to get Persian And Arabic Characters in php

I Want To Get Ascii Code from Persian characters.

My Code:

<?php
header ('Content-Type: text/html; charset=UTF-8'); 
$Char = "س"; // This is a Persian Character
echo ord($Char); // Output: 216
echo ord(utf8_encode($Char)); // Output: 195
// The Real Code Of This Character: 1587
?>

Upvotes: 2

Views: 858

Answers (1)

Syscall
Syscall

Reputation: 19780

You could use mb_ord() to get the code point of a multibyte character :

$Char = "س"; // This is a Persian Character
echo mb_ord($Char); // Output: 1587

Upvotes: 2

Related Questions