// Purpose
// Used to calculate the sum of a sequence of digits.
// Parameters
// DigitSequence (String) = The digit sequence we are working with.
// Return (Number)
// Returns the sum of all digits in the specified sequence.
// Entry Conditions
// Each character must be a valid digit between 0 and 9 or function may crash.
// Version History
// 1.0 4/25/2004 Tested by Russ Tanner
//---
function SumOfDigitSequence($DigitSequence) {
// Initiate variables
$R = 0; // Return buffer
// Main loop: Sum all digits in the sequence
for ($C = 0, $lenDS = strlen($DigitSequence); $C < $lenDS; $C++) {
$R = $R + $DigitSequence{$C}; // Accumulate the sum
}
// Return the result
return $R;
}
The Captian Today they call you "crazy". Tomorrow they call you "ahead of your time." Global Skywatch Learn about Chemtrails - You're breathing them now! OnlyTheBestHerbs.com World-class supplements Mercury Talk Why you are sick. OneUp Domains Domains, Hosting, Email 1-800-358-4278 (U.S. & Canada)