Skip to content

Instantly share code, notes, and snippets.

@sionex-code
Created October 14, 2014 22:37
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 sionex-code/11f73ccbcffb4098003c to your computer and use it in GitHub Desktop.
Save sionex-code/11f73ccbcffb4098003c to your computer and use it in GitHub Desktop.
Simple Addition Function Without Arguments in php
<?php
/*
simple function to get addition of some or more varible at once without doing much coding
just use addition(2,3,4,3/4,2-1); you can use what ever you want
*/
function addition(){
$output = 0;
$arguments = func_get_args();
foreach ($arguments as $arg){
$output += $arg;
}
return $output;
}
echo addition(2,2,5,7,8,9); //output 33
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment