public static function isValid($hashtag)
    {
        $hashtag = ltrim($hashtag, '#');
        if (empty($hashtag)) {
            return false;
        }

        $test = preg_replace('/[^a-zA-Z0-9_]/', '', $hashtag);
        if ($test !== $hashtag) {
            return false;
        }

        if ('_' === $hashtag[0]) {
            return false;
        }

        $len = strlen($hashtag);
        if ($len > 139) {
            return false;
        }

        for ($i = 0; $i < $len; $i++) {
            if (!is_numeric($hashtag[$i])) {
                return true;
            }
        }

        return false;
    }
public static function isValid($hashtag)
    {
        $hashtag = ltrim($hashtag, '#');
        if (empty($hashtag)) {
            return false;
        }

        $test = preg_replace('/[^a-zA-Z0-9_]/', '', $hashtag);
        if ($test !== $hashtag) {
            return false;
        }

        if ('_' === $hashtag[0]) {
            return false;
        }

        $len = strlen($hashtag);
        if ($len > 139) {
            return false;
        }

        for ($i = 0; $i < $len; $i++) {
            if (!is_numeric($hashtag[$i])) {
                return true;
            }
        }

        return false;
    }
public static function isValid ( $ hashtag ) { $ hashtag = ltrim ( $ hashtag , '#' ) ; if ( empty ( $ hashtag ) ) { return false ; } $ test = preg_replace ( '/[^a-zA-Z0-9_]/' , '' , $ hashtag ) ; if ( $ test !== $ hashtag ) { return false ; } if ( '_' === $ hashtag [ 0 ] ) { return false ; } $ len = strlen ( $ hashtag ) ; if ( $ len > 139 ) { return false ; } for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { if ( ! is_numeric ( $ hashtag [ $ i ] ) ) { return true ; } } return false ; }
Returns true if the provided hashtag conforms to the rules.

@param string $hashtag

@return boolean
Returns true if the provided hashtag conforms to the rules .