Mvc\Model::average

public static double average ([array $parameters])

Allows to calculate the average value on a column matching the specified conditions

//What's the average price of robots?
 $average = Robots::average(array('column' => 'price'));
 echo "The average price is ", $average, "\n";

 //What's the average price of mechanical robots?
 $average = Robots::average(array("type='mechanical'", 'column' => 'price'));
 echo "The average price of mechanical robots is ", $average, "\n";
doc_Phalcon
2016-10-16 09:52:47
Comments
Leave a Comment

Please login to continue.