Skip to content

Instantly share code, notes, and snippets.

@kvz
Created April 12, 2011 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvz/915304 to your computer and use it in GitHub Desktop.
Save kvz/915304 to your computer and use it in GitHub Desktop.
Groups nested hour registration data & sums up the total overage in 2011 per customer
<?php
// Thank you CakePHP Set::combine() & PHP5.3 : )
// http://book.cakephp.org/view/1492/combine
$cust_overage = array_map(function ($regs) {
return array_sum($regs);
}, Set::combine(
$this->Hour->overage(2011),
'/Hour/id',
'/Hour/amount',
'/Hour/customer_id'
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment