Re: order of arguments in the Date_Calc class

From: Date: Wed, 15 Nov 2000 14:28:20 +0000
Subject: Re: order of arguments in the Date_Calc class
References: 1  Groups: php.pear 
Request: Send a blank email to php-pear+get-448@lists.php.net to get a copy of this message
Hi Chuck, That makes sense to me. This will break backward compatability with scripts currently using the class, but if it's going to be changed, now is better than later. There is also another problem in the script that may affect what you are after here. This is at the top of most of the functions: if(empty($year) || empty($month) || empty($day)) { $year = $this->dateNow("%Y"); $month = $this->dateNow("%m"); $day = $this->dateNow("%d"); } This should probably be rewritten to something like: if(empty($year)) $year = $this->dateNow("%Y"); if(empty($month)) $month = $this->dateNow("%m"); if(empty($day)) $day = $this->dateNow("%d"); I also have a few other changes that I haven't committed to PEAR yet, so I'll make the above changes if you'd like. Monte Chuck Hagenbuch wrote: > > A lot of the functions in the Date/Calc.php file have the order of arguments > like so: > > funcname($year = '', $month = '', $day = '') { ... > > This seems weird to me; I'm more likely to want to default to the current year > than I am to the current day. > > I'd like to go through and change the function definitions. Any objections? > > -chuck > > -- > Charles Hagenbuch, <chuck@horde.org> > "If you can't stand the heat, get out of the chicken!" - Baby Blues > > -- > PHP Extension and Add-on Repository (PEAR) mailing list. > Documentation can be found at http://pear.php.net/doc/pear.html > To unsubscribe, e-mail: php-pear-unsubscribe@lists.php.net from the > mail address you subscribed with. -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

« previous php.pear (#448) next »