Reply to Re: [PHP] cal_days_in_month() missing, how can I tell if it exists

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация