You should be trying http://www.php.net/manual/en/function.ord.php
I wonder why your tests didnt fail?