I'm facing a weird problem with the PHP ord() function when using it on ASCII characters from the extended ASCII table :
<?php
echo ord('!'); // prints 33 : OK
echo ord('a'); // prints 97 : OK
echo ord('é'); // prints 195 : NOT OK
echo ord('ü'); // prints 195 : NOT OK
?>
Do you have any idea why this function has this behavior ?
Moreover i'd like to specify that i'm actually trying to create a really simple steganography program that converts a message character by character into it's binary representation (using the ASCII table) and then creating a simple black and white 8xC pixels image (where C corresponds to the number of characters in total) and that this is why i'm dealing with this kind of stuff.
I was just wondering how to use and how to apply what I just learned about PHP GD's library, so i thought this would be a great training !
Thanks in advance for your answers (and sorry for my english) !
ord()
does not supports utf-8. Use this function for unicode characters:PS: you can use
uniord()
for both type of characters perfectly.