バージョン: v2.3.0
count
条件に一致する行数を数えます。
count($table, $where)
table [string]
対象のテーブル名。
where [array] (省略可)
集計対象を絞り込む WHERE 条件。
count($table, $join, $column, $where)
table [string]
対象のテーブル名。
join [array]
関連テーブルを結合するための JOIN 定義。JOIN が不要な場合は省略できます。
column [string]
件数を数える基準となるカラム。
where [array] (省略可)
集計対象を絞り込む WHERE 条件。
戻り値
[int] 条件に一致する行数。
このメソッドは常に整数を返します。
$count = $database->count("account", [
"gender" => "female"
]);
echo "女性ユーザーは {$count} 人です。";