RE: [PHP] Php Array
| From: | Boget, Chris | Date: | Fri, 16 Nov 2001 20:37:27 +0000 |
| Subject: | RE: [PHP] Php Array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-74932@lists.php.net to get a copy of this message | ||
> How can I send the values inside the array into a function
> for calculation?
function addValues( $arrayVar ) {
$reteval = 0;
foreach( $arrayVar as $element ) {
$retval += $element;
}
return $retval;
}
$myArray = array( 1, 2, 3, 4, 4 );
echo addValues( $myArray );
Chris