Re: Help with a function
| From: | Web Master | Date: | Fri, 08 Dec 2000 16:25:51 +0000 |
| Subject: | Re: Help with a function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29369@lists.php.net to get a copy of this message | ||
may be this sound too stupid, but the number_format is in a single line or is
wrapped around? 'Caz you function and calling looks good to me and I don't see
any problems at all.
"Phillip S. Baker" wrote:
> Greetings Folks,
>
> I created this function.
>
> function win_pct($win, $draw, $played)
> {
> if($played == 0) { $played = 1; };
> $win_pct += ($win + ($draw * .5)) / $played;
> return $win_pct;
> }
>
> I am using this line to call it.
> $winner_win_pct = number_format(win_pct($update_win_win,
> $win_draw, $update_win_played), 3); // calculate the win percentage
> of the player
> $loser_win_pct = number_format(win_pct($lose_win,
> $lose_draw, $update_lose_played), 3); // calculate the win percentage
> of the player
>
> When I run the script I get the following errors.
> Warning: Missing argument 2 for win_pct() in ../../includes/scoring.inc on
> line 20
> Warning: Missing argument 3 for win_pct() in ../../includes/scoring.inc on
> line 20
> ( the line 20 refers to this line function win_pct($win, $draw, $played))
>
> The thing I do not understand however, is that the functions still works as
> intend accurately calculating the win percentage.
> That being the case why am I getting the errors?
>
> Thanks
>
> Phillip S. Baker
>
> phillip@wordsandimages.com
> Words & Images
> 1535 Seabright Avenue, Suite 100, Santa Cruz, CA 95062
> Direct Line (831) 420-2641 / Fax (831) 458-0808