public static function isObjectId($value)
    {
        if (is_object($value) && method_exists($value, '__toString')) {
            $value = (string) $value;
        }

        return is_string($value) && 24 == strlen($value) && ctype_xdigit($value);
    }
public static function isObjectId($value)
    {
        if (is_object($value) && method_exists($value, '__toString')) {
            $value = (string) $value;
        }

        return is_string($value) && 24 == strlen($value) && ctype_xdigit($value);
    }
public static function isObjectId ( $ value ) { if ( is_object ( $ value ) && method_exists ( $ value , '__toString' ) ) { $ value = ( string ) $ value ; } return is_string ( $ value ) && 24 == strlen ( $ value ) && ctype_xdigit ( $ value ) ; }
Checks if the given value can be a valid ObjectId.

@param mixed $value string to be evaluated if it can be used as a valid ObjectID

@return bool true if is valid
Checks if the given value can be a valid ObjectId .