encoding.php
protected function isOnlyAscii($ascii)
    {
        for ($i = 0, $length = strlen($ascii); $i < $length; $i++) {
            if (ord($ascii[$i]) > 127) {
                return false;
            }
        }

        return true;
    }
protected function isOnlyAscii($ascii)
    {
        for ($i = 0, $length = strlen($ascii); $i < $length; $i++) {
            if (ord($ascii[$i]) > 127) {
                return false;
            }
        }

        return true;
    }
Tests each character is in the range 0-127.

@param string $ascii    String to test.