def arraysize(x):
    """
    Returns the number of elements in x, where x is an array.

    Args:
        x: the array for which you want to get the number of elements.

    Returns:
        int: the size of the array. If **x** is not an array, this function returns 0.


    """
    if '__len__' in dir(x):
        return len(x)
    return 0