Skip to content

Instantly share code, notes, and snippets.

@suzuken

suzuken/sum.php

Created Sep 27, 2016
Embed
What would you like to do?
<?php
function sum() {
$sum = 0;
foreach (func_get_args() as $arg) {
$sum += $arg;
}
return $sum;
}
printf("%d\n", sum(1, 2));
printf("%d\n", sum(1, 2, 3));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.