private static int tryGetChar(Memory value){
        if (value.type == Memory.Type.INT){
            int val = (int)value.toLong();
            if (val > -128 && val <= Character.MAX_CODE_POINT){
                if (val < 0)
                    val += 256;

                return val;
            }
        }
        return -1;
    }
ctype extension
documentation: http://us1.php.net/manual/ru/book.ctype.php

 Notice: supports UNICODE
exts/jphp-zend-ext/src/main/java/org/develnext/jphp/zend/ext/standard/CTypeFunctions.java