Answer the question
In order to leave comments, you need to log in
Why is ord returning a different code from the ASCII table?
Here is the actual code:
echo ord('c')."\n"; // английская c (выдает 99 - нормально)
echo ord('с'); // русская с (выдает 209, хотя это код большой буквы С, должно быть 241)
Answer the question
In order to leave comments, you need to log in
UTF-8, Russian characters take 2 bytes.
$st = 'с'; // русская с
echo ord($st[0]), ' ' , ord($st[1]);
// 209 129
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question