Supported Versions: PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8
Check for alphanumeric character(s)
<?php ctype_alnum(mixed $text): bool
<?php     public function isValidId($id)

    {

        return is_string($id) && ctype_alnum($id) && strlen($id) === 40;

    }