PHP function to check if a string is all lowercase

Solution:

Well, if you just want a simple-purpose check, you could just compare the original string with an strtolowerred string. Of course, it won’t be foolproof. Like this:

function check_lowercase_string($string) {
    return ($string === strtolower($string));
}

$string = 'Hi! I am a string';
var_dump(check_lowercase_string($string)); // false
var_dump(check_lowercase_string('test')); // true

painful attempt of no functions:

function check_lowercase_string($string) {
    $chars = '';
    // map all small characters
    for($alpha = 'a'; $alpha != 'aa'; $alpha++) { $small[] = $alpha; }
    $l = 0; // not strlen() :p
    while (@$string[$l] != '') {
        $l++;
    }
    for($i = 0; $i < $l; $i++) { // for each string input piece
        foreach($small as $letter) { // for each mapped letter
            if($string[$i] == $letter) {
                $chars .= $letter; // simple filter
            }
        }
    }

    // if they are still equal in the end then true, if they are not, false
    return ($chars === $string);
}

var_dump(check_lowercase_string('teSt')); // false