Created
October 14, 2014 22:37
-
-
Save sionex-code/11f73ccbcffb4098003c to your computer and use it in GitHub Desktop.
Simple Addition Function Without Arguments in php
This file contains 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 | |
/* | |
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