core-bundle/src/Resources/contao/library/Contao/Model.php
public static function countBy($strColumn=null, $varValue=null, array $arrOptions=array())
	{
		if (static::$strTable == '')
		{
			return 0;
		}

		$arrOptions = array_merge
		(
			array
			(
				'table'  => static::$strTable,
				'column' => $strColumn,
				'value'  => $varValue
			),

			$arrOptions
		);

		$strQuery = static::buildCountQuery($arrOptions);

		return (int) Database::getInstance()->prepare($strQuery)->execute($arrOptions['value'])->count;
	}
public static function countBy($strColumn=null, $varValue=null, array $arrOptions=array())
	{
		if (static::$strTable == '')
		{
			return 0;
		}

		$arrOptions = array_merge
		(
			array
			(
				'table'  => static::$strTable,
				'column' => $strColumn,
				'value'  => $varValue
			),

			$arrOptions
		);

		$strQuery = static::buildCountQuery($arrOptions);

		return (int) Database::getInstance()->prepare($strQuery)->execute($arrOptions['value'])->count;
	}
Return the number of records matching certain criteria

@param mixed $strColumn  An optional property name
@param mixed $varValue   An optional property value
@param array $arrOptions An optional options array

@return integer The number of matching rows