Version: v2.4.0
avg
Calculate the average value of a column.
avg($table, $column, $where)
table [string]
The name of the table to query.
column [string]
The column to evaluate.
where [array] (optional)
The WHERE clause used to filter the result set.
avg($table, $join, $column, $where)
table [string]
The name of the table to query.
join [array]
The join definitions used to combine related tables.
column [string]
The column to evaluate.
where [array] (optional)
The WHERE clause used to filter the result set.
Return Value
[mixed] The average value of the specified column.
$average = $database->avg("account", "age", [
"gender" => "male"
]);
echo "Average age (male): {$average}";