src/Queries/ElementQuery.php
public function count()
    {
        if ($this->queryShouldBeStopped) {
            return 0;
        }

        $filter = $this->normalizeFilter();
        $queryType = "ElementQuery::count";

        $callback = function () use ($filter) {
            return (int) $this->bxObject->GetList(false, $filter, []);
        };

        return $this->handleCacheIfNeeded(compact('filter', 'queryType'), $callback);
    }
public function count()
    {
        if ($this->queryShouldBeStopped) {
            return 0;
        }

        $filter = $this->normalizeFilter();
        $queryType = "ElementQuery::count";

        $callback = function () use ($filter) {
            return (int) $this->bxObject->GetList(false, $filter, []);
        };

        return $this->handleCacheIfNeeded(compact('filter', 'queryType'), $callback);
    }
public function count ( ) { if ( $ this -> queryShouldBeStopped ) { return 0 ; } $ filter = $ this -> normalizeFilter ( ) ; $ queryType = "ElementQuery::count" ; $ callback = function ( ) use ( $ filter ) { return ( int ) $ this -> bxObject -> GetList ( false , $ filter , [ ] ) ; } ; return $ this -> handleCacheIfNeeded ( compact ( 'filter' , 'queryType' ) , $ callback ) ; }
Get count of elements that match $filter.

@return int
Get count of elements that match $filter .