|
Posted by RaTT on 02/02/05 03:30
Hi James,
http://uk.php.net/manual/en/function.function-exists.php, should help
you on your way.
hth
Jarratt
On Tue, 1 Feb 2005 18:57:12 -0600, James Kaufman
<jmk@kaufman.eden-prairie.mn.us> wrote:
> On Tue, Feb 01, 2005 at 08:47:29PM +0000, Ben Edwards wrote:
> > I have been implementing a system on a different ISP than I normally use
> > and have got:-
> >
> > Fatal error: Call to undefined function: cal_days_in_month()
> > in /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php
> > on line 134
> >
> > I found a reference to this an the web and it seems PHP is not compiled
> > with calender support.
> >
> > "recompile php with the "--enable-calendar" option."
> >
> > Cant see being able to get the to re-compile PHP so I guess I am going
> > to have to disable the feature. I seem to remember a while ago seeing a
> > function to test weather a function exists in PHP. That way I can have
> > the relevant validation skipped if the function is missing (I will tell
> > the client if they get decent hosting it will start working).
> >
> > So something like
> >
> > function_exists( cal_days_in_month() )
> >
> > Anyone know what the function is called.
> >
> > Ben
> >
>
> I do this:
>
> if (!extension_loaded('calendar'))
> {
> /*
> * cal_days_in_month($month, $year)
> * Returns the number of days in a given month and year,
> * taking into account leap years.
> *
> * $month: numeric month (integers 1-12)
> * $year: numeric year (any integer)
> *
> * Prec: $month is an integer between 1 and 12, inclusive
> * $year is an integer.
> * Post: none
> */
> function cal_days_in_month($month, $year)
> {
> return $month == 2 ? $year % 4 ? 28 : 29 : ($month % 7 % 2 ? 31 : 30);
> }
> }
>
> --
> Jim Kaufman
> Linux Evangelist
> public key 0x6D802619, CISSP# 65668
> http://www.linuxforbusiness.net
> ---
> The shortest distance between two points is through Hell.
> --Brian Clark
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
[Back to original message]
|