Re: [PHP] cal_days_in_month() missing, how can I tell if it exists
On Tue, 1 Feb 2005 18:57:12 -0600, James Kaufman <[EMAIL PROTECTED]> wrote: > On Tue, Feb 01, 2005 at 08:47:29PM +, 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); > } > } thanks, I was using $days_in_month = cal_days_in_month( CAL_GREGORIAN, $month, $year ); Is the first parameter optionel. If it is I guess PHP must have overloaded internal functions. Ben > -- > 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 > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cal_days_in_month() missing, how can I tell if it exists
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 <[EMAIL PROTECTED]> wrote: > On Tue, Feb 01, 2005 at 08:47:29PM +, 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cal_days_in_month() missing, how can I tell if it exists
On Tue, Feb 01, 2005 at 08:47:29PM +, 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
Re: [PHP] cal_days_in_month() missing, how can I tell if it exists
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() ) oi Ben nice guess mate ;-) only function_exists() take a string as a arg: if (function_exists('cal_days_in_month')) { /*.. */ } Anyone know what the function is called. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cal_days_in_month() missing, how can I tell if it exists
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 -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php