Re: Looping Addition
| From: | Stephen | Date: | Thu, 05 Dec 2002 15:05:07 +0000 |
| Subject: | Re: Looping Addition | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127152@lists.php.net to get a copy of this message | ||
So would I just put this?
foreach(%_POST['number'] as $num)
{
$output *= $num;
}
echo $output;
That's for multiplication.
----- Original Message -----
From: "1LT John W. Holmes" <holmes072000@charter.net>
To: "Stephen" <webmaster@melchior.us>
Cc: "PHP List" <php-general@lists.php.net>
Sent: Thursday, December 05, 2002 8:24 AM
Subject: Re: [PHP] Looping Addition
> > One more question... If I then wanted to do this for the other
operations
> > (such as multiplication, division, etc), how would I do that?
>
> Assuming you've figured out how to do an array...
>
> You'll have to loop through the values like in the code that others
posted.
>
> foreach($_POST['number'] as $num)
> { //calculate total here with $num }
>
> * = multiplication
> / = divide
>
> ---John Holmes...
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>