Created
July 30, 2008 19:42
-
-
Save maddox/3313 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## php | |
function number_of_items(){ | |
$count = 0; | |
foreach ($this->queries as $query) { | |
$count += sizeof($query->items); | |
} | |
return $count; | |
} | |
## ruby | |
def number_of_items | |
queries.inject(0) {|query, count| count += query.items.size } | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment