Help with a function

From: Date: Fri, 08 Dec 2000 15:56:54 +0000
Subject: Help with a function
Groups: php.general 
Request: Send a blank email to php-general+get-29366@lists.php.net to get a copy of this message
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

« previous php.general (#29366) next »