protected function charCodeAt($index)
    {
        $body = $this->source->getBody();
        $char = mb_substr($body, $index, 1, 'UTF-8');

        if (mb_check_encoding($char, 'UTF-8')) {
            return hexdec(bin2hex(mb_convert_encoding($char, 'UTF-32BE', 'UTF-8')));
        } else {
            return NULL;
        }
    }
protected function charCodeAt($index)
    {
        $body = $this->source->getBody();
        $char = mb_substr($body, $index, 1, 'UTF-8');

        if (mb_check_encoding($char, 'UTF-8')) {
            return hexdec(bin2hex(mb_convert_encoding($char, 'UTF-32BE', 'UTF-8')));
        } else {
            return NULL;
        }
    }
protected function charCodeAt ( $ index ) { $ body = $ this -> source -> getBody ( ) ; $ char = mb_substr ( $ body , $ index , 1 , 'UTF-8' ) ; if ( mb_check_encoding ( $ char , 'UTF-8' ) ) { return hexdec ( bin2hex ( mb_convert_encoding ( $ char , 'UTF-32BE' , 'UTF-8' ) ) ) ; } else { return NULL ; } }
Implementation of JavaScript's String.prototype.charCodeAt function.

@param int $index

@return null|number
Implementation of JavaScript s String . prototype . charCodeAt function .